diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2021-03-29 13:41:42 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-29 13:41:42 +0000 |
commit | ac3499cc9605dd2c7bfccedd6f9a95c7bc0dd9ad (patch) | |
tree | 401c7ddec178185b6af4dc782bfbba4d20673e06 /cmd/podman/images | |
parent | 259004f0a9cc18018127baec0bfcf8bc091dabb6 (diff) | |
parent | 4d5199537737b0cfef47d3d2700013a787126d21 (diff) | |
download | podman-ac3499cc9605dd2c7bfccedd6f9a95c7bc0dd9ad.tar.gz podman-ac3499cc9605dd2c7bfccedd6f9a95c7bc0dd9ad.tar.bz2 podman-ac3499cc9605dd2c7bfccedd6f9a95c7bc0dd9ad.zip |
Merge pull request #9631 from rhatdan/pull
Fix podman build --pull-never
Diffstat (limited to 'cmd/podman/images')
-rw-r--r-- | cmd/podman/images/build.go | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/cmd/podman/images/build.go b/cmd/podman/images/build.go index f757b764f..da6d556b1 100644 --- a/cmd/podman/images/build.go +++ b/cmd/podman/images/build.go @@ -303,6 +303,21 @@ func buildFlagsWrapperToOptions(c *cobra.Command, contextDir string, flags *buil return nil, err } + pullFlagsCount := 0 + if c.Flag("pull").Changed { + pullFlagsCount++ + } + if c.Flag("pull-always").Changed { + pullFlagsCount++ + } + if c.Flag("pull-never").Changed { + pullFlagsCount++ + } + + if pullFlagsCount > 1 { + return nil, errors.Errorf("can only set one of 'pull' or 'pull-always' or 'pull-never'") + } + pullPolicy := define.PullIfMissing if c.Flags().Changed("pull") && flags.Pull { pullPolicy = define.PullAlways @@ -312,7 +327,7 @@ func buildFlagsWrapperToOptions(c *cobra.Command, contextDir string, flags *buil } if flags.PullNever { - pullPolicy = define.PullIfMissing + pullPolicy = define.PullNever } args := make(map[string]string) |