Skip to content

Commit

Permalink
Trim env. variable names and values; support trailing comma (cdrx#71)
Browse files Browse the repository at this point in the history
  • Loading branch information
dimw authored Sep 7, 2021
1 parent dbe9cb1 commit a24d813
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions rancher_gitlab_deploy/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,8 +254,14 @@ def main(
variables_as_array = variables.split(",")

for variable_item in variables_as_array:
key, value = variable_item.split("=", 1)
defined_environment_variables[key] = value
variable_item = variable_item.strip()

if variable_item:
key, value = variable_item.split("=", 1)
key = key.strip()
value = value.strip()

defined_environment_variables[key] = value

if variable:
for item in variable:
Expand All @@ -269,8 +275,13 @@ def main(
secrets_as_array = secrets.split(",")

for secret_item in secrets_as_array:
key, value = secret_item.split("=", 1)
defined_secrets.append({"type": "secretReference", "name": key})
secret_item = secret_item.strip()

if secret_item:
key, value = secret_item.split("=", 1)
key = key.strip()

defined_secrets.append({"type": "secretReference", "name": key})

if secret:
for item in secret:
Expand Down

0 comments on commit a24d813

Please sign in to comment.