kubernetes-sigs / cluster-api-provider-openstack

Cluster API implementation for OpenStack
https://cluster-api-openstack.sigs.k8s.io/
Apache License 2.0
279 stars 252 forks source link

env.rc parses the password variable incorrectly #1952

Closed JanGutter closed 4 months ago

JanGutter commented 4 months ago

/kind bug

What steps did you take and what happened:

When creating a credential for OpenStack using the command: source env.rc path/to/clouds.yaml sample

The command failed with an error: Error: yaml: did not find expected node content

This happened because the password contained a comma.

What did you expect to happen:

The credentials to be correctly parsed and converted.

Anything else you would like to add:

This bug was introduced in back in https://github.com/kubernetes-sigs/cluster-api-provider-openstack/commit/4be90a99c588b09046677646819aabc78ce11a56

Example:

This fails: echo "a:" | FOO=",123" ./yq e ".a.b = env(FOO) " - with: Error: yaml: did not find expected node content

The fix is to use strenv: echo "a:" | FOO=",123" ./yq e ".a.b = strenv(FOO) " - returning:

a:
  b: ',123'

Environment: