diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2020-07-06 17:15:26 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-07-06 17:15:26 -0400 |
commit | 1a93857acc4ee1e5a9213e2c22f12802d84cd277 (patch) | |
tree | d3f8c923e0750fa4aa5ed423dca52640a8ff187c /pkg/specgen/container_validate.go | |
parent | b1cc781c68964dff3ee4a00ef7ce71f56ae69e7c (diff) | |
parent | 10ad46eb7377ff504a65783a7a604b248b50f20a (diff) | |
download | podman-1a93857acc4ee1e5a9213e2c22f12802d84cd277.tar.gz podman-1a93857acc4ee1e5a9213e2c22f12802d84cd277.tar.bz2 podman-1a93857acc4ee1e5a9213e2c22f12802d84cd277.zip |
Merge pull request #6693 from goochjj/libpod-sd-notify-cmdline
Implement --sdnotify cmdline option to control sd-notify behavior
Diffstat (limited to 'pkg/specgen/container_validate.go')
-rw-r--r-- | pkg/specgen/container_validate.go | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/pkg/specgen/container_validate.go b/pkg/specgen/container_validate.go index 8063bee38..bf03ff0e7 100644 --- a/pkg/specgen/container_validate.go +++ b/pkg/specgen/container_validate.go @@ -3,6 +3,7 @@ package specgen import ( "strings" + "github.com/containers/libpod/v2/libpod/define" "github.com/containers/libpod/v2/pkg/rootless" "github.com/containers/libpod/v2/pkg/util" "github.com/pkg/errors" @@ -13,6 +14,8 @@ var ( ErrInvalidSpecConfig = errors.New("invalid configuration") // SystemDValues describes the only values that SystemD can be SystemDValues = []string{"true", "false", "always"} + // SdNotifyModeValues describes the only values that SdNotifyMode can be + SdNotifyModeValues = []string{define.SdNotifyModeContainer, define.SdNotifyModeConmon, define.SdNotifyModeIgnore} // ImageVolumeModeValues describes the only values that ImageVolumeMode can be ImageVolumeModeValues = []string{"ignore", "tmpfs", "anonymous"} ) @@ -40,6 +43,10 @@ func (s *SpecGenerator) Validate() error { if len(s.ContainerBasicConfig.Systemd) > 0 && !util.StringInSlice(strings.ToLower(s.ContainerBasicConfig.Systemd), SystemDValues) { return errors.Wrapf(ErrInvalidSpecConfig, "--systemd values must be one of %q", strings.Join(SystemDValues, ", ")) } + // sdnotify values must be container, conmon, or ignore + if len(s.ContainerBasicConfig.SdNotifyMode) > 0 && !util.StringInSlice(strings.ToLower(s.ContainerBasicConfig.SdNotifyMode), SdNotifyModeValues) { + return errors.Wrapf(ErrInvalidSpecConfig, "--sdnotify values must be one of %q", strings.Join(SdNotifyModeValues, ", ")) + } // // ContainerStorageConfig |