Beispiel #1
0
// NewExecCommand creates a new Exec command instance.
func NewExecCommand(c ssh.Client) *Exec {
	return &Exec{
		common:       &commonFlags{},
		SSHClient:    c,
		clientGetter: getter.New(),
	}
}
Beispiel #2
0
// NewLogCommand creates a new Log command instance.
func NewLogCommand(c ssh.Client) *Log {
	return &Log{
		SSHClient:    c,
		clientGetter: getter.New(),
		common:       &commonFlags{},
	}
}
Beispiel #3
0
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")
	}
}
Beispiel #4
0
// NewMachineCommand creates a new Machine command instance.
func NewMachineCommand() *Machine {
	return &Machine{
		commonFlags:  &commonFlags{},
		clientGetter: getter.New(),
	}
}
Beispiel #5
0
// NewContainerCommand creates a new Container command instance.
func NewContainerCommand() *Container {
	return &Container{
		clientGetter: getter.New(),
		commonFlags:  &commonFlags{},
	}
}
Beispiel #6
0
// NewSSHCommand creates a new SSH command instance.
func NewSSHCommand() *SSH {
	return &SSH{
		clientGetter: getter.New(),
		common:       &commonFlags{},
	}
}
Beispiel #7
0
// NewRunCommand creates a new Run command instance.
func NewRunCommand() *Run {
	return &Run{
		common:       &commonFlags{},
		clientGetter: getter.New(),
	}
}
Beispiel #8
0
// NewStopCommand creates a new Stop command instance.
func NewStopCommand() *Stop {
	return &Stop{
		clientGetter: getter.New(),
		common:       &commonFlags{},
	}
}