// NewExecCommand creates a new Exec command instance. func NewExecCommand(c ssh.Client) *Exec { return &Exec{ common: &commonFlags{}, SSHClient: c, clientGetter: getter.New(), } }
// NewLogCommand creates a new Log command instance. func NewLogCommand(c ssh.Client) *Log { return &Log{ SSHClient: c, clientGetter: getter.New(), common: &commonFlags{}, } }
func main() { clientGetter := getter.New() clnt, err := clientGetter.Client(api.DefaultSocket) if err != nil { log.WithError(err).Fatal("FAILED, couldn't get quiltctl client") } defer clnt.Close() leader, err := clientGetter.LeaderClient(clnt) if err != nil { log.WithError(err).Fatal("FAILED, couldn't get leader client") } tester, err := newNetworkTester(leader) if err != nil { log.WithError(err).Fatal("FAILED, couldn't initialize network tester") } containers, err := leader.QueryContainers() if err != nil { log.WithError(err).Fatal("FAILED, couldn't query containers") } var failed bool for _, res := range runTests(tester, containers) { fmt.Println(res.container) if len(res.unauthorized) != 0 { failed = true fmt.Println(".. FAILED, could ping unauthorized containers") for _, unauthorized := range res.unauthorized { fmt.Printf(".... %s\n", unauthorized) } } if len(res.unreachable) != 0 { failed = true fmt.Println(".. FAILED, couldn't ping authorized containers") for _, unreachable := range res.unreachable { fmt.Printf(".... %s\n", unreachable) } } } if !failed { fmt.Println("PASSED") } }
// NewMachineCommand creates a new Machine command instance. func NewMachineCommand() *Machine { return &Machine{ commonFlags: &commonFlags{}, clientGetter: getter.New(), } }
// NewContainerCommand creates a new Container command instance. func NewContainerCommand() *Container { return &Container{ clientGetter: getter.New(), commonFlags: &commonFlags{}, } }
// NewSSHCommand creates a new SSH command instance. func NewSSHCommand() *SSH { return &SSH{ clientGetter: getter.New(), common: &commonFlags{}, } }
// NewRunCommand creates a new Run command instance. func NewRunCommand() *Run { return &Run{ common: &commonFlags{}, clientGetter: getter.New(), } }
// NewStopCommand creates a new Stop command instance. func NewStopCommand() *Stop { return &Stop{ clientGetter: getter.New(), common: &commonFlags{}, } }