本文整理匯總了Golang中github.com/tsuru/tsuru/provision.App.Restart方法的典型用法代碼示例。如果您正苦於以下問題:Golang App.Restart方法的具體用法?Golang App.Restart怎麽用?Golang App.Restart使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/tsuru/tsuru/provision.App
的用法示例。
在下文中一共展示了App.Restart方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: Git
func Git(provisioner provision.Provisioner, app provision.App, objID string, w io.Writer) error {
log.Write(w, []byte("\n ---> tsuru receiving push\n"))
log.Write(w, []byte("\n ---> Replicating the application repository across units\n"))
out, err := clone(provisioner, app)
if err != nil {
out, err = fetch(provisioner, app)
}
if err != nil {
msg := fmt.Sprintf("Got error while cloning/fetching repository: %s -- \n%s", err, string(out))
log.Write(w, []byte(msg))
return errors.New(msg)
}
out, err = checkout(provisioner, app, objID)
if err != nil {
msg := fmt.Sprintf("Failed to checkout Git repository: %s -- \n%s", err, string(out))
log.Write(w, []byte(msg))
return errors.New(msg)
}
log.Write(w, []byte("\n ---> Installing dependencies\n"))
if err := provisioner.InstallDeps(app, w); err != nil {
log.Write(w, []byte(err.Error()))
return err
}
log.Write(w, []byte("\n ---> Restarting application\n"))
if err := app.Restart(w); err != nil {
log.Write(w, []byte(err.Error()))
return err
}
return log.Write(w, []byte("\n ---> Deploy done!\n\n"))
}
示例2: injectEnvsAndRestart
func injectEnvsAndRestart(a provision.App) {
time.Sleep(5e9)
err := a.SerializeEnvVars()
if err != nil {
log.Errorf("Failed to serialize env vars: %s.", err)
}
var buf bytes.Buffer
w := app.LogWriter{App: a, Writer: &buf}
err = a.Restart(&w)
if err != nil {
log.Errorf("Failed to restart app %q (%s): %s.", a.GetName(), err, buf.String())
}
}