[config] stream output of app-restart & post-config-update plugn triggers to stdout/err
This commit is contained in:
1 parent
f8e3bdc56b
commit
5fbe28f672
2 files changed
+8
-7
No files matched your search
@@ -345,13 +345,12 @@ func VerifyImage(image string) bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//PlugnTrigger fire the given plugn trigger with the given args
|
//PlugnTrigger fire the given plugn trigger with the given args
|
||||||
func PlugnTrigger(triggerName string, args ...string) (string, error) {
|
func PlugnTrigger(triggerName string, args ...string) error {
|
||||||
shellArgs := make([]interface{}, len(args)+2)
|
shellArgs := make([]interface{}, len(args)+2)
|
||||||
shellArgs[0] = "trigger"
|
shellArgs[0] = "trigger"
|
||||||
shellArgs[1] = triggerName
|
shellArgs[1] = triggerName
|
||||||
for i, arg := range args {
|
for i, arg := range args {
|
||||||
shellArgs[i+2] = arg
|
shellArgs[i+2] = arg
|
||||||
}
|
}
|
||||||
res, err := sh.Command("plugn", shellArgs...).Output()
|
return sh.Command("plugn", shellArgs...).Run()
|
||||||
return string(res), err
|
|
||||||
}
|
}
|
||||||
@@ -73,14 +73,16 @@ func UnsetMany(appName string, keys []string, restart bool) (err error) {
|
|||||||
|
|
||||||
func triggerRestart(appName string) {
|
func triggerRestart(appName string) {
|
||||||
common.LogInfo1(fmt.Sprintf("Restarting app %s", appName))
|
common.LogInfo1(fmt.Sprintf("Restarting app %s", appName))
|
||||||
output, _ := common.PlugnTrigger("app-restart", appName)
|
if err := common.PlugnTrigger("app-restart", appName); err != nil {
|
||||||
fmt.Printf(output)
|
common.LogWarn(fmt.Sprintf("Failure while restarting app: %s", err))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func triggerUpdate(appName string, operation string, args []string) {
|
func triggerUpdate(appName string, operation string, args []string) {
|
||||||
args = append([]string{appName, operation}, args...)
|
args = append([]string{appName, operation}, args...)
|
||||||
output, _ := common.PlugnTrigger("post-config-update", args...)
|
if err := common.PlugnTrigger("post-config-update", args...); err != nil {
|
||||||
fmt.Printf(output)
|
common.LogWarn(fmt.Sprintf("Failure while triggering post-config-update: %s", err))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func loadAppOrGlobalEnv(appName string) (env *Env, err error) {
|
func loadAppOrGlobalEnv(appName string) (env *Env, err error) {
|
||||||
|
|||||||
Reference in new issue
Block a user