Use simple string instead of JSON string for pre/post update commands.

This commit is contained in:
Alexandre Menif 2018-06-18 19:37:32 +02:00
parent 25c7853f03
commit 78a375f86e
5 changed files with 26 additions and 88 deletions

View file

@ -51,13 +51,10 @@ func Update(client container.Client, filter container.Filter, cleanup bool, noRe
if container.Stale {
// Execute the pre-update command if it is defined.
preUpdateCommandInfo, err := container.PreUpdateCommandInfo()
if err != nil {
log.Error("Error while reading pre-update command info.")
log.Error(err)
} else if preUpdateCommandInfo.IsDefined() {
preUpdateCommand := container.PreUpdateCommand()
if len(preUpdateCommand) > 0 {
log.Info("Executing pre-update command.")
if err := client.ExecuteCommand(container, preUpdateCommandInfo); err != nil {
if err := client.ExecuteCommand(container, preUpdateCommand); err != nil {
log.Error(err)
}
}
@ -87,13 +84,10 @@ func Update(client container.Client, filter container.Filter, cleanup bool, noRe
log.Error(err)
} else {
// Execute the post-update command if it is defined.
postUpdateCommandInfo, err := container.PostUpdateCommandInfo()
if err != nil {
log.Error("Error while reading post-update command info.")
log.Error(err)
} else if postUpdateCommandInfo.IsDefined() {
postUpdateCommand := container.PostUpdateCommand()
if len(postUpdateCommand) > 0 {
log.Info("Executing post-update command.")
if err := client.ExecuteCommand(container, postUpdateCommandInfo); err != nil {
if err := client.ExecuteCommand(container, postUpdateCommand); err != nil {
log.Error(err)
}
}