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