Skip to content

Commit 9783d1b

Browse files
committed
feedback refactor allowed values name
Signed-off-by: Filinto Duran <[email protected]>
1 parent e2f366e commit 9783d1b

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

pkg/runfileconfig/run_file_config_parser.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ import (
2626
"gopkg.in/yaml.v2"
2727
)
2828

29+
var imagePullPolicyValuesAllowed = []string{"Always", "Never", "IfNotPresent"}
30+
2931
// Parse the provided run file into a RunFileConfig struct.
3032
func (a *RunFileConfig) parseAppsConfig(runFilePath string) error {
3133
var err error
@@ -100,9 +102,8 @@ func (a *RunFileConfig) validateRunConfig(runFilePath string) error {
100102

101103
// Check containerImagePullPolicy is valid
102104
if a.Apps[i].ContainerImagePullPolicy != "" {
103-
allowedValues := []string{"Always", "Never", "IfNotPresent"}
104-
if !utils.Contains(allowedValues, a.Apps[i].ContainerImagePullPolicy) {
105-
return fmt.Errorf("invalid containerImagePullPolicy: %s, allowed values: %v", a.Apps[i].ContainerImagePullPolicy, allowedValues)
105+
if !utils.Contains(imagePullPolicyValuesAllowed, a.Apps[i].ContainerImagePullPolicy) {
106+
return fmt.Errorf("invalid containerImagePullPolicy: %s, allowed values: %s", a.Apps[i].ContainerImagePullPolicy, strings.Join(imagePullPolicyValuesAllowed, ", "))
106107
}
107108
} else {
108109
a.Apps[i].ContainerImagePullPolicy = "Always"

0 commit comments

Comments
 (0)