Skip to content
This repository has been archived by the owner on Jun 14, 2024. It is now read-only.

Fix problem with values that contains "=" in --set operation #22

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

guidiego
Copy link

Motivation

Today we are using Kube Render into Coteminas to create some config values. Unfortunately we use --set to set a Base64 value that comes with a = at the end of the string.

When we apply it to the actual version of kube render it throws this error:

File "/opt/hostedtoolcache/Python/3.9.0/x64/lib/python3.9/site-packages/kuberender/render.py", line 38, in parse_statement
    key, value = override_statement.split('=')
ValueError: too many values to unpack (expected 2)

The Fix

To avoid this kind of problem I get the first = position into the string and did a manually split using array operators :)

@guidiego guidiego changed the title Fix overriden vars logic Fix problem with values that contains "=" in --set operation Oct 16, 2020
@guidiego guidiego force-pushed the chore/fix-problem-with-eq-in-val branch from 42568a1 to 7c1381b Compare October 16, 2020 19:38
Copy link
Member

@ygormutti ygormutti left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Besides the comment, LGTM


# Image and tag were overriden but pullPolicy (which is a sibling) wasn't modified
assert 'bitnami/redis:3.0.7' == get_value(manifest, 'spec/template/spec/containers/0/image')
assert 'test=' == get_value(manifest, 'spec/template/spec/containers/0/imagePullPolicy')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[minor] IMHO this test case repeats too much from the one above. Consider adding an assertion to check other.key equals value-containing-equal-sign= there and removing this.

@felipemsantana felipemsantana removed their request for review June 17, 2022 17:19
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants