You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Related BZ: https://bugzilla.redhat.com/show_bug.cgi?id=1369679
Passing key-value pairs to `oc set env` with certain invalid characters
causes an unrelated error to be rendered. This is caused because the
regex that separates key-value pairs from resource-type/resource
arguments does not account for invalid key-value pairs with invalid
characters (other than "-"). This means that when a command such as
`oc set env rc/node-1 test#abc=1234` is executed, `test#abc=1234`
will not be recognized as a key-value pair, and instead be treated
as a resource without a resource type, giving a user the wrong reason
for command failure.
This patch updates the regex matching env key-value pairs to match
any character from the beginning of the arg to the equal sign rather
than a select amount of characters, ensuring that key-value pair
arguments with any kind of invalid character are still recognized as
such.
\##### Before
`$ oc set env rc/node-1 test-@abc=1234`
```
there is no need to specify a resource type as a separate argument when
passing arguments in resource/name form (e.g. 'oc get
resource/<resource_name>' instead of 'oc get resource
resource/<resource_name>'
```
\##### After
`$ oc set env rc/node-1 test@-abc=1234`
```
error: ReplicationController "node-1" is invalid:
spec.template.spec.containers[0].env[3].name: Invalid value:
"test@-abc": must be a C identifier (matching regex
[A-Za-z_][A-Za-z0-9_]*): e.g. "my_name" or "MyName"
```
0 commit comments