Implement pre and post-update command execution.

This commit is contained in:
Alexandre Menif 2018-05-27 20:59:53 +02:00
parent 8197bb669d
commit 60d47a5749
4 changed files with 137 additions and 6 deletions

27
container/command_info.go Normal file
View file

@ -0,0 +1,27 @@
package container
import (
"encoding/json"
)
type CommandInfo struct {
User string
Privileged bool
Env []string
Cmd []string
}
func ReadCommandInfoFromJSON(commandInfoJSON string) (CommandInfo, error) {
commandInfo := CommandInfo{}
err := json.Unmarshal([]byte(commandInfoJSON), &commandInfo)
if err != nil {
return CommandInfo{}, err
}
return commandInfo, nil
}
func (commandInfo CommandInfo) IsDefined() bool {
return commandInfo.Cmd != nil && len(commandInfo.Cmd) > 0
}