本文整理匯總了Golang中github.com/contiv/remotessh.TestbedNode.RunCommand方法的典型用法代碼示例。如果您正苦於以下問題:Golang TestbedNode.RunCommand方法的具體用法?Golang TestbedNode.RunCommand怎麽用?Golang TestbedNode.RunCommand使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/contiv/remotessh.TestbedNode
的用法示例。
在下文中一共展示了TestbedNode.RunCommand方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: restartDockerHost
func restartDockerHost(node remotessh.TestbedNode) error {
logrus.Infof("Restarting docker on %q", node.GetName())
// note that for all these restart tasks we error out quietly to avoid other
// hosts being cleaned up
node.RunCommand("sudo service docker restart")
return nil
}
示例2: restartNetplugin
func restartNetplugin(node remotessh.TestbedNode) error {
logrus.Infof("Restarting netplugin on %q", node.GetName())
err := node.RunCommand("sudo systemctl restart netplugin netmaster")
if err != nil {
return err
}
time.Sleep(5 * time.Second)
return nil
}
示例3: clearContainerHost
func (s *systemtestSuite) clearContainerHost(node remotessh.TestbedNode) error {
startedContainers.Lock()
names := []string{}
for name := range startedContainers.names {
names = append(names, name)
}
startedContainers.Unlock()
logrus.Infof("Clearing containers %v on %q", names, node.GetName())
node.RunCommand(fmt.Sprintf("docker rm -f %s", strings.Join(names, " ")))
return nil
}
示例4: runCommandUntilNoError
func runCommandUntilNoError(node remotessh.TestbedNode, cmd string, timeout int) error {
runCmd := func() (string, bool) {
if err := node.RunCommand(cmd); err != nil {
return "", false
}
return "", true
}
timeoutMessage := fmt.Sprintf("timeout reached trying to run %v on %q", cmd, node.GetName())
_, err := WaitForDone(runCmd, 10*time.Millisecond, time.Duration(timeout)*time.Second, timeoutMessage)
return err
}
示例5: ClearEtcd
func ClearEtcd(node remotessh.TestbedNode) {
log.Infof("Clearing etcd data")
node.RunCommand(`for i in $(etcdctl ls /); do etcdctl rm --recursive "$i"; done`)
}
示例6: clearVolumeHost
func (s *systemtestSuite) clearVolumeHost(node remotessh.TestbedNode) error {
logrus.Infof("Clearing volumes on %q", node.GetName())
node.RunCommand("docker volume ls | tail -n +2 | awk '{ print $2 }' | xargs docker volume rm")
return nil
}
示例7: stopVolplugin
func stopVolplugin(node remotessh.TestbedNode) error {
logrus.Infof("Stopping the volplugin on %q", node.GetName())
defer time.Sleep(time.Second)
return node.RunCommand("sudo systemctl stop volplugin")
}
示例8: stopAPIServer
func stopAPIServer(node remotessh.TestbedNode) error {
logrus.Infof("Stopping the apiserver on %q", node.GetName())
defer time.Sleep(time.Second)
return node.RunCommand("sudo systemctl stop apiserver")
}
示例9: ClearEtcd
func ClearEtcd(node remotessh.TestbedNode) {
logrus.Info("Waiting for etcd")
node.RunCommand("while ! $(etcdctl cluster-health | tail -1 | grep -q 'cluster is healthy'); do sleep 1; done")
logrus.Info("Clearing etcd data")
node.RunCommand("etcdctl rm --recursive /volplugin")
}