Skip to content

Commit d3df274

Browse files
committed
cli: remove support for comma-separated template values
1 parent 8fd5cd2 commit d3df274

33 files changed

+141
-44
lines changed

docs/man/man1/oc-cluster-up.1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ A public hostname can also be specified for the server with the \-\-public\-host
3939

4040
.PP
4141
\fB\-e\fP, \fB\-\-env\fP=[]
42-
Specify key value pairs of environment variables to set on OpenShift container
42+
Specify a key\-value pair for an environment variable to set on OpenShift container
4343

4444
.PP
4545
\fB\-\-forward\-ports\fP=false

docs/man/man1/oc-env.1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ DEPRECATED: This command has been moved to "oc set env"
2727

2828
.PP
2929
\fB\-e\fP, \fB\-\-env\fP=[]
30-
Specify key value pairs of environment variables to set into each container.
30+
Specify a key\-value pair for an environment variable to set into each container.
3131

3232
.PP
3333
\fB\-f\fP, \fB\-\-filename\fP=[]

docs/man/man1/oc-new-app.1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ If you provide source code, a new build will be automatically triggered. You can
5656

5757
.PP
5858
\fB\-e\fP, \fB\-\-env\fP=[]
59-
Specify key\-value pairs of environment variables to set into each container. This doesn't apply to objects created from a template, use parameters instead.
59+
Specify a key\-value pair for an environment variable to set into each container. This doesn't apply to objects created from a template, use parameters instead.
6060

6161
.PP
6262
\fB\-f\fP, \fB\-\-file\fP=[]
@@ -108,7 +108,7 @@ If you provide source code, a new build will be automatically triggered. You can
108108

109109
.PP
110110
\fB\-p\fP, \fB\-\-param\fP=[]
111-
Specify a list of key value pairs (e.g., \-p FOO=BAR,BAR=FOO) to set/override parameter values in the template.
111+
Specify a key\-value pair (e.g., \-p FOO=BAR) to set/override a parameter value in the template.
112112

113113
.PP
114114
\fB\-S\fP, \fB\-\-search\fP=false

docs/man/man1/oc-new-build.1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ Once the build configuration is created a new build will be automatically trigge
6464

6565
.PP
6666
\fB\-e\fP, \fB\-\-env\fP=[]
67-
Specify key value pairs of environment variables to set into resulting image.
67+
Specify a key\-value pair for an environment variable to set into resulting image.
6868

6969
.PP
7070
\fB\-\-image\fP=[]

docs/man/man1/oc-process.1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ The output of the process command is always a list of one or more resources. You
5454

5555
.PP
5656
\fB\-v\fP, \fB\-\-value\fP=[]
57-
Specify a list of key\-value pairs (eg. \-v FOO=BAR,BAR=FOO) to set/override parameter values
57+
Specify a key\-value pair (eg. \-v FOO=BAR) to set/override a parameter value in the template.
5858

5959

6060
.SH OPTIONS INHERITED FROM PARENT COMMANDS

docs/man/man1/oc-set-deployment-hook.1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ Each hook can have its own cancellation policy. One of: abort, retry, or ignore.
4242

4343
.PP
4444
\fB\-e\fP, \fB\-\-environment\fP=[]
45-
Environment variables to use in the deployment hook pod
45+
Environment variable to use in the deployment hook pod
4646

4747
.PP
4848
\fB\-\-failure\-policy\fP="ignore"

docs/man/man1/oc-set-env.1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ If "\-\-env \-" is passed, environment variables can be read from STDIN using th
3333

3434
.PP
3535
\fB\-e\fP, \fB\-\-env\fP=[]
36-
Specify key value pairs of environment variables to set into each container.
36+
Specify a key\-value pair for an environment variable to set into each container.
3737

3838
.PP
3939
\fB\-f\fP, \fB\-\-filename\fP=[]

docs/man/man1/oc-start-build.1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ In addition, you can pass a file, directory, or source code repository with the
3333

3434
.PP
3535
\fB\-e\fP, \fB\-\-env\fP=[]
36-
Specify key value pairs of environment variables to set for the build container.
36+
Specify a key\-value pair for an environment variable to set for the build container.
3737

3838
.PP
3939
\fB\-F\fP, \fB\-\-follow\fP=false

docs/man/man1/openshift-cli-cluster-up.1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ A public hostname can also be specified for the server with the \-\-public\-host
3939

4040
.PP
4141
\fB\-e\fP, \fB\-\-env\fP=[]
42-
Specify key value pairs of environment variables to set on OpenShift container
42+
Specify a key\-value pair for an environment variable to set on OpenShift container
4343

4444
.PP
4545
\fB\-\-forward\-ports\fP=false

docs/man/man1/openshift-cli-env.1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ DEPRECATED: This command has been moved to "openshift cli set env"
2727

2828
.PP
2929
\fB\-e\fP, \fB\-\-env\fP=[]
30-
Specify key value pairs of environment variables to set into each container.
30+
Specify a key\-value pair for an environment variable to set into each container.
3131

3232
.PP
3333
\fB\-f\fP, \fB\-\-filename\fP=[]

docs/man/man1/openshift-cli-new-app.1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ If you provide source code, a new build will be automatically triggered. You can
5656

5757
.PP
5858
\fB\-e\fP, \fB\-\-env\fP=[]
59-
Specify key\-value pairs of environment variables to set into each container. This doesn't apply to objects created from a template, use parameters instead.
59+
Specify a key\-value pair for an environment variable to set into each container. This doesn't apply to objects created from a template, use parameters instead.
6060

6161
.PP
6262
\fB\-f\fP, \fB\-\-file\fP=[]
@@ -108,7 +108,7 @@ If you provide source code, a new build will be automatically triggered. You can
108108

109109
.PP
110110
\fB\-p\fP, \fB\-\-param\fP=[]
111-
Specify a list of key value pairs (e.g., \-p FOO=BAR,BAR=FOO) to set/override parameter values in the template.
111+
Specify a key\-value pair (e.g., \-p FOO=BAR) to set/override a parameter value in the template.
112112

113113
.PP
114114
\fB\-S\fP, \fB\-\-search\fP=false

docs/man/man1/openshift-cli-new-build.1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ Once the build configuration is created a new build will be automatically trigge
6464

6565
.PP
6666
\fB\-e\fP, \fB\-\-env\fP=[]
67-
Specify key value pairs of environment variables to set into resulting image.
67+
Specify a key\-value pair for an environment variable to set into resulting image.
6868

6969
.PP
7070
\fB\-\-image\fP=[]

docs/man/man1/openshift-cli-process.1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ The output of the process command is always a list of one or more resources. You
5454

5555
.PP
5656
\fB\-v\fP, \fB\-\-value\fP=[]
57-
Specify a list of key\-value pairs (eg. \-v FOO=BAR,BAR=FOO) to set/override parameter values
57+
Specify a key\-value pair (eg. \-v FOO=BAR) to set/override a parameter value in the template.
5858

5959

6060
.SH OPTIONS INHERITED FROM PARENT COMMANDS

docs/man/man1/openshift-cli-set-deployment-hook.1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ Each hook can have its own cancellation policy. One of: abort, retry, or ignore.
4242

4343
.PP
4444
\fB\-e\fP, \fB\-\-environment\fP=[]
45-
Environment variables to use in the deployment hook pod
45+
Environment variable to use in the deployment hook pod
4646

4747
.PP
4848
\fB\-\-failure\-policy\fP="ignore"

docs/man/man1/openshift-cli-set-env.1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ If "\-\-env \-" is passed, environment variables can be read from STDIN using th
3333

3434
.PP
3535
\fB\-e\fP, \fB\-\-env\fP=[]
36-
Specify key value pairs of environment variables to set into each container.
36+
Specify a key\-value pair for an environment variable to set into each container.
3737

3838
.PP
3939
\fB\-f\fP, \fB\-\-filename\fP=[]

docs/man/man1/openshift-cli-start-build.1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ In addition, you can pass a file, directory, or source code repository with the
3333

3434
.PP
3535
\fB\-e\fP, \fB\-\-env\fP=[]
36-
Specify key value pairs of environment variables to set for the build container.
36+
Specify a key\-value pair for an environment variable to set for the build container.
3737

3838
.PP
3939
\fB\-F\fP, \fB\-\-follow\fP=false

pkg/bootstrap/docker/up.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ var (
108108
)
109109

110110
// NewCmdUp creates a command that starts openshift on Docker with reasonable defaults
111-
func NewCmdUp(name, fullName string, f *osclientcmd.Factory, out io.Writer) *cobra.Command {
111+
func NewCmdUp(name, fullName string, f *osclientcmd.Factory, out, errout io.Writer) *cobra.Command {
112112
config := &ClientStartConfig{
113113
Out: out,
114114
PortForwarding: defaultPortForwarding(),
@@ -120,7 +120,7 @@ func NewCmdUp(name, fullName string, f *osclientcmd.Factory, out io.Writer) *cob
120120
Example: fmt.Sprintf(cmdUpExample, fullName),
121121
Run: func(c *cobra.Command, args []string) {
122122
kcmdutil.CheckErr(config.Complete(f, c))
123-
kcmdutil.CheckErr(config.Validate(out))
123+
kcmdutil.CheckErr(config.Validate(out, errout))
124124
if err := config.Start(out); err != nil {
125125
os.Exit(1)
126126
}
@@ -139,7 +139,7 @@ func NewCmdUp(name, fullName string, f *osclientcmd.Factory, out io.Writer) *cob
139139
cmd.Flags().StringVar(&config.HostDataDir, "host-data-dir", "", "Directory on Docker host for OpenShift data. If not specified, etcd data will not be persisted on the host.")
140140
cmd.Flags().BoolVar(&config.PortForwarding, "forward-ports", config.PortForwarding, "Use Docker port-forwarding to communicate with origin container. Requires 'socat' locally.")
141141
cmd.Flags().IntVar(&config.ServerLogLevel, "server-loglevel", 0, "Log level for OpenShift server")
142-
cmd.Flags().StringSliceVarP(&config.Environment, "env", "e", config.Environment, "Specify key value pairs of environment variables to set on OpenShift container")
142+
cmd.Flags().StringArrayVarP(&config.Environment, "env", "e", config.Environment, "Specify a key-value pair for an environment variable to set on OpenShift container")
143143
cmd.Flags().BoolVar(&config.ShouldInstallMetrics, "metrics", false, "Install metrics (experimental)")
144144
cmd.Flags().BoolVar(&config.ShouldInstallLogging, "logging", false, "Install logging (experimental)")
145145
return cmd
@@ -313,7 +313,8 @@ func (c *ClientStartConfig) Complete(f *osclientcmd.Factory, cmd *cobra.Command)
313313
}
314314

315315
// Validate validates that required fields in StartConfig have been populated
316-
func (c *ClientStartConfig) Validate(out io.Writer) error {
316+
func (c *ClientStartConfig) Validate(out, errout io.Writer) error {
317+
cmdutil.WarnAboutCommaSeparation(errout, c.Environment, "--env")
317318
if len(c.Tasks) == 0 {
318319
return fmt.Errorf("no startup tasks to execute")
319320
}

pkg/cmd/cli/cli.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ func NewCommandCLI(name, fullName string, in io.Reader, out, errout io.Writer) *
100100
cmd.NewCmdProject(fullName+" project", f, out),
101101
cmd.NewCmdProjects(fullName, f, out),
102102
cmd.NewCmdExplain(fullName, f, out, errout),
103-
cluster.NewCmdCluster(cluster.ClusterRecommendedName, fullName+" "+cluster.ClusterRecommendedName, f, out),
103+
cluster.NewCmdCluster(cluster.ClusterRecommendedName, fullName+" "+cluster.ClusterRecommendedName, f, out, errout),
104104
cmd.NewCmdIdle(fullName, f, out, errout),
105105
},
106106
},
@@ -156,7 +156,7 @@ func NewCommandCLI(name, fullName string, in io.Reader, out, errout io.Writer) *
156156
cmd.NewCmdReplace(fullName, f, out),
157157
cmd.NewCmdApply(fullName, f, out),
158158
cmd.NewCmdPatch(fullName, f, out),
159-
cmd.NewCmdProcess(fullName, f, out),
159+
cmd.NewCmdProcess(fullName, f, out, errout),
160160
cmd.NewCmdExport(fullName, f, in, out),
161161
cmd.NewCmdExtract(fullName, f, in, out, errout),
162162
observe.NewCmdObserve(fullName, f, out, errout),

pkg/cmd/cli/cmd/cluster/cluster.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ var (
3333
routing suffix, use the --routing-suffix flag.`)
3434
)
3535

36-
func NewCmdCluster(name, fullName string, f *clientcmd.Factory, out io.Writer) *cobra.Command {
36+
func NewCmdCluster(name, fullName string, f *clientcmd.Factory, out, errout io.Writer) *cobra.Command {
3737
// Parent command to which all subcommands are added.
3838
cmds := &cobra.Command{
3939
Use: fmt.Sprintf("%s ACTION", name),
@@ -42,7 +42,7 @@ func NewCmdCluster(name, fullName string, f *clientcmd.Factory, out io.Writer) *
4242
Run: cmdutil.DefaultSubCommandRun(out),
4343
}
4444

45-
cmds.AddCommand(docker.NewCmdUp(docker.CmdUpRecommendedName, fullName+" "+docker.CmdUpRecommendedName, f, out))
45+
cmds.AddCommand(docker.NewCmdUp(docker.CmdUpRecommendedName, fullName+" "+docker.CmdUpRecommendedName, f, out, errout))
4646
cmds.AddCommand(docker.NewCmdDown(docker.CmdDownRecommendedName, fullName+" "+docker.CmdDownRecommendedName, f, out))
4747
cmds.AddCommand(docker.NewCmdStatus(docker.CmdStatusRecommendedName, fullName+" "+docker.CmdStatusRecommendedName, f, out))
4848
return cmds

pkg/cmd/cli/cmd/helper.go

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
package cmd
22

3-
import "strings"
3+
import (
4+
"strings"
5+
6+
"github.com/golang/glog"
7+
"github.com/spf13/cobra"
8+
)
49

510
// parseNamespaceResourceName parses the value and returns namespace, resource and the
611
// value (resource name) itself. The valid syntax is:
@@ -20,3 +25,13 @@ func parseNamespaceResourceName(v, defaultNamespace string) (ns, resource, name
2025
}
2126
return "", "", "", false
2227
}
28+
29+
// TODO: GetFlagStringArray already exists in kubernetes master, remove this
30+
// after rebasing to version that has it
31+
func getFlagStringArray(cmd *cobra.Command, flag string) []string {
32+
s, err := cmd.Flags().GetStringArray(flag)
33+
if err != nil {
34+
glog.Fatalf("error accessing flag %s for command %s: %v", flag, cmd.Name(), err)
35+
}
36+
return s
37+
}

pkg/cmd/cli/cmd/newapp.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,9 +166,9 @@ func NewCmdNewApplication(name, baseName string, f *clientcmd.Factory, out, erro
166166
cmd.Flags().StringSliceVar(&config.Templates, "template", config.Templates, "Name of a stored template to use in the app.")
167167
cmd.Flags().StringSliceVarP(&config.TemplateFiles, "file", "f", config.TemplateFiles, "Path to a template file to use for the app.")
168168
cmd.MarkFlagFilename("file", "yaml", "yml", "json")
169-
cmd.Flags().StringSliceVarP(&config.TemplateParameters, "param", "p", config.TemplateParameters, "Specify a list of key value pairs (e.g., -p FOO=BAR,BAR=FOO) to set/override parameter values in the template.")
169+
cmd.Flags().StringArrayVarP(&config.TemplateParameters, "param", "p", config.TemplateParameters, "Specify a key-value pair (e.g., -p FOO=BAR) to set/override a parameter value in the template.")
170170
cmd.Flags().StringSliceVar(&config.Groups, "group", config.Groups, "Indicate components that should be grouped together as <comp1>+<comp2>.")
171-
cmd.Flags().StringSliceVarP(&config.Environment, "env", "e", config.Environment, "Specify key-value pairs of environment variables to set into each container. This doesn't apply to objects created from a template, use parameters instead.")
171+
cmd.Flags().StringArrayVarP(&config.Environment, "env", "e", config.Environment, "Specify a key-value pair for an environment variable to set into each container. This doesn't apply to objects created from a template, use parameters instead.")
172172
cmd.Flags().StringVar(&config.Name, "name", "", "Set name to use for generated application artifacts")
173173
cmd.Flags().StringVar(&config.Strategy, "strategy", "", "Specify the build strategy to use if you don't want to detect (docker|source).")
174174
cmd.Flags().StringP("labels", "l", "", "Label to set in all resources for this application.")
@@ -209,6 +209,9 @@ func (o *NewAppOptions) Complete(baseName, name string, f *clientcmd.Factory, c
209209

210210
o.Config.DryRun = o.Action.DryRun
211211

212+
cmdutil.WarnAboutCommaSeparation(o.ErrOut, o.Config.Environment, "--env")
213+
cmdutil.WarnAboutCommaSeparation(o.ErrOut, o.Config.TemplateParameters, "--param")
214+
212215
o.CommandPath = c.CommandPath()
213216
o.BaseName = baseName
214217
o.CommandName = name

pkg/cmd/cli/cmd/newbuild.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ func NewCmdNewBuild(name, baseName string, f *clientcmd.Factory, in io.Reader, o
128128
cmd.Flags().StringVar(&config.Name, "name", "", "Set name to use for generated build artifacts.")
129129
cmd.Flags().StringVar(&config.To, "to", "", "Push built images to this image stream tag (or Docker image repository if --to-docker is set).")
130130
cmd.Flags().BoolVar(&config.OutputDocker, "to-docker", false, "Have the build output push to a Docker repository.")
131-
cmd.Flags().StringSliceVarP(&config.Environment, "env", "e", config.Environment, "Specify key value pairs of environment variables to set into resulting image.")
131+
cmd.Flags().StringArrayVarP(&config.Environment, "env", "e", config.Environment, "Specify a key-value pair for an environment variable to set into resulting image.")
132132
cmd.Flags().StringVar(&config.Strategy, "strategy", "", "Specify the build strategy to use if you don't want to detect (docker|source).")
133133
cmd.Flags().StringVarP(&config.Dockerfile, "dockerfile", "D", "", "Specify the contents of a Dockerfile to build directly, implies --strategy=docker. Pass '-' to read from STDIN.")
134134
cmd.Flags().BoolVar(&config.BinaryBuild, "binary", false, "Instead of expecting a source URL, set the build to expect binary contents. Will disable triggers.")
@@ -173,6 +173,8 @@ func (o *NewBuildOptions) Complete(baseName, commandName string, f *clientcmd.Fa
173173
o.CommandPath = c.CommandPath()
174174
o.CommandName = commandName
175175

176+
cmdutil.WarnAboutCommaSeparation(o.ErrOut, o.Config.Environment, "--env")
177+
176178
mapper, _ := f.Object(false)
177179
o.PrintObject = cmdutil.VersionedPrintObject(f.PrintObject, c, mapper, out)
178180
o.LogsForObject = f.LogsForObject

pkg/cmd/cli/cmd/process.go

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import (
2020

2121
"github.com/openshift/origin/pkg/cmd/cli/describe"
2222
"github.com/openshift/origin/pkg/cmd/templates"
23+
cmdutil "github.com/openshift/origin/pkg/cmd/util"
2324
"github.com/openshift/origin/pkg/cmd/util/clientcmd"
2425
"github.com/openshift/origin/pkg/template"
2526
templateapi "github.com/openshift/origin/pkg/template/api"
@@ -57,20 +58,20 @@ var (
5758
)
5859

5960
// NewCmdProcess implements the OpenShift cli process command
60-
func NewCmdProcess(fullName string, f *clientcmd.Factory, out io.Writer) *cobra.Command {
61+
func NewCmdProcess(fullName string, f *clientcmd.Factory, out, errout io.Writer) *cobra.Command {
6162
cmd := &cobra.Command{
6263
Use: "process (TEMPLATE | -f FILENAME) [-v=KEY=VALUE]",
6364
Short: "Process a template into list of resources",
6465
Long: processLong,
6566
Example: fmt.Sprintf(processExample, fullName),
6667
Run: func(cmd *cobra.Command, args []string) {
67-
err := RunProcess(f, out, cmd, args)
68+
err := RunProcess(f, out, errout, cmd, args)
6869
kcmdutil.CheckErr(err)
6970
},
7071
}
7172
cmd.Flags().StringP("filename", "f", "", "Filename or URL to file to read a template")
7273
cmd.MarkFlagFilename("filename", "yaml", "yml", "json")
73-
cmd.Flags().StringSliceP("value", "v", nil, "Specify a list of key-value pairs (eg. -v FOO=BAR,BAR=FOO) to set/override parameter values")
74+
cmd.Flags().StringArrayP("value", "v", nil, "Specify a key-value pair (eg. -v FOO=BAR) to set/override a parameter value in the template.")
7475
cmd.Flags().BoolP("parameters", "", false, "Do not process but only print available parameters")
7576
cmd.Flags().StringP("labels", "l", "", "Label to set in all resources for this template")
7677

@@ -83,7 +84,7 @@ func NewCmdProcess(fullName string, f *clientcmd.Factory, out io.Writer) *cobra.
8384
}
8485

8586
// RunProcess contains all the necessary functionality for the OpenShift cli process command
86-
func RunProcess(f *clientcmd.Factory, out io.Writer, cmd *cobra.Command, args []string) error {
87+
func RunProcess(f *clientcmd.Factory, out, errout io.Writer, cmd *cobra.Command, args []string) error {
8788
templateName, valueArgs := "", []string{}
8889
for _, s := range args {
8990
isValue := strings.Contains(s, "=")
@@ -102,9 +103,11 @@ func RunProcess(f *clientcmd.Factory, out io.Writer, cmd *cobra.Command, args []
102103

103104
var flagValues []string
104105
if cmd.Flag("value").Changed {
105-
flagValues = kcmdutil.GetFlagStringSlice(cmd, "value")
106+
flagValues = getFlagStringArray(cmd, "value")
106107
}
107108

109+
cmdutil.WarnAboutCommaSeparation(errout, flagValues, "--value")
110+
108111
for _, value := range flagValues {
109112
key := strings.Split(value, "=")[0]
110113
if keys.Has(key) {
@@ -238,7 +241,7 @@ func RunProcess(f *clientcmd.Factory, out io.Writer, cmd *cobra.Command, args []
238241
// Override the values for the current template parameters
239242
// when user specify the --value
240243
if cmd.Flag("value").Changed {
241-
values := kcmdutil.GetFlagStringSlice(cmd, "value")
244+
values := getFlagStringArray(cmd, "value")
242245
if errs := injectUserVars(values, obj); errs != nil {
243246
return kerrors.NewAggregate(errs)
244247
}

pkg/cmd/cli/cmd/set/deploymenthook.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ func NewCmdDeploymentHook(fullName string, f *clientcmd.Factory, out, errOut io.
123123
cmd.Flags().BoolVar(&options.Mid, "mid", options.Mid, "Set or remove a mid deployment hook")
124124
cmd.Flags().BoolVar(&options.Post, "post", options.Post, "Set or remove a post deployment hook")
125125

126-
cmd.Flags().StringSliceVarP(&options.Environment, "environment", "e", options.Environment, "Environment variables to use in the deployment hook pod")
126+
cmd.Flags().StringArrayVarP(&options.Environment, "environment", "e", options.Environment, "Environment variable to use in the deployment hook pod")
127127
cmd.Flags().StringSliceVarP(&options.Volumes, "volumes", "v", options.Volumes, "Volumes from the pod template to use in the deployment hook pod")
128128

129129
cmd.Flags().String("failure-policy", "ignore", "The failure policy for the deployment hook. Valid values are: abort,retry,ignore")
@@ -233,6 +233,9 @@ func (o *DeploymentHookOptions) Validate() error {
233233
if len(o.Command) == 0 {
234234
return fmt.Errorf("you must specify a command for the deployment hook")
235235
}
236+
237+
cmdutil.WarnAboutCommaSeparation(o.Err, o.Environment, "--environment")
238+
236239
return nil
237240
}
238241

0 commit comments

Comments
 (0)