本文整理匯總了Golang中github.com/coreos/fleet/functional/platform.Cluster.MemberCommand方法的典型用法代碼示例。如果您正苦於以下問題:Golang Cluster.MemberCommand方法的具體用法?Golang Cluster.MemberCommand怎麽用?Golang Cluster.MemberCommand使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/coreos/fleet/functional/platform.Cluster
的用法示例。
在下文中一共展示了Cluster.MemberCommand方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: waitForFleetdSocket
// waitForFleetdSocket returns if /var/run/fleet.sock exists, periodically
// checking for states.
func waitForFleetdSocket(cluster platform.Cluster, m0 platform.Member) (err error) {
_, err = util.WaitForState(
func() bool {
stdout, _, _ := cluster.MemberCommand(m0, "test -S /var/run/fleet.sock && echo 1")
if strings.TrimSpace(stdout) == "" {
fmt.Errorf("Fleetd is not fully started, retrying...")
return false
}
return true
},
)
if err != nil {
return fmt.Errorf("Fleetd socket not found: %v", err)
}
return nil
}
示例2: waitForReloadConfig
// waitForReloadConfig returns if a message "Reloading configuration" exists
// in the journal, periodically checking for the journal up to the timeout.
func waitForReloadConfig(cluster platform.Cluster, m0 platform.Member) (err error) {
_, err = util.WaitForState(
func() bool {
// NOTE: journalctl should run just simply like "journalctl -u fleet",
// without being piped with grep. Doing
// "journalctl -u fleet | grep \"Reloading configuration\"" is racy
// in a subtle way, so that it sometimes fails only on semaphoreci.
// - dpark 20160408
stdout, _, _ := cluster.MemberCommand(m0, "sudo", "journalctl --priority=info _PID=$(pidof fleetd)")
journalfleet := strings.TrimSpace(stdout)
if !strings.Contains(journalfleet, "Reloading configuration") {
fmt.Errorf("Fleetd is not fully reconfigured, retrying... entire fleet journal:\n%v", journalfleet)
return false
}
return true
},
)
if err != nil {
return fmt.Errorf("Reloading configuration log not found: %v", err)
}
return nil
}