summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2020-09-13 17:08:44 -0400
committerGitHub <noreply@github.com>2020-09-13 17:08:44 -0400
commit3f5f99b8839c391f3bc2450ac0c5ddc6960c88b9 (patch)
tree6b65d17bea3f0f1249d03d1cd3bf1f16da13e08d
parent25fb0c2b966c193e8c4045e440316850f6f1b889 (diff)
parent81f99c3ecd85bb67a18f2aa14b8dd8f2344fefa8 (diff)
downloadpodman-3f5f99b8839c391f3bc2450ac0c5ddc6960c88b9.tar.gz
podman-3f5f99b8839c391f3bc2450ac0c5ddc6960c88b9.tar.bz2
podman-3f5f99b8839c391f3bc2450ac0c5ddc6960c88b9.zip
Merge pull request #7619 from rhatdan/pulltype
pull types allow initial caps
-rw-r--r--pkg/util/utils.go24
1 files changed, 6 insertions, 18 deletions
diff --git a/pkg/util/utils.go b/pkg/util/utils.go
index 82282a549..7612d3012 100644
--- a/pkg/util/utils.go
+++ b/pkg/util/utils.go
@@ -537,33 +537,21 @@ func OpenExclusiveFile(path string) (*os.File, error) {
return os.OpenFile(path, os.O_RDWR|os.O_CREATE|os.O_EXCL, 0666)
}
-// PullType whether to pull new image
-type PullType int
+type PullType = config.PullPolicy
-const (
+var (
// PullImageAlways always try to pull new image when create or run
- PullImageAlways PullType = iota
+ PullImageAlways = config.PullImageAlways
// PullImageMissing pulls image if it is not locally
- PullImageMissing
+ PullImageMissing = config.PullImageMissing
// PullImageNever will never pull new image
- PullImageNever
+ PullImageNever = config.PullImageNever
)
// ValidatePullType check if the pullType from CLI is valid and returns the valid enum type
// if the value from CLI is invalid returns the error
func ValidatePullType(pullType string) (PullType, error) {
- switch pullType {
- case "always":
- return PullImageAlways, nil
- case "missing", "IfNotPresent":
- return PullImageMissing, nil
- case "never":
- return PullImageNever, nil
- case "":
- return PullImageMissing, nil
- default:
- return PullImageMissing, errors.Errorf("invalid pull type %q", pullType)
- }
+ return config.ValidatePullPolicy(pullType)
}
// ExitCode reads the error message when failing to executing container process