mirror of
https://github.com/containrrr/watchtower.git
synced 2026-03-01 18:30:17 +01:00
Implement pre and post-update command execution.
This commit is contained in:
parent
8197bb669d
commit
60d47a5749
4 changed files with 137 additions and 6 deletions
27
container/command_info.go
Normal file
27
container/command_info.go
Normal 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
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue