本文整理汇总了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())
}
}