From 5e178cab68859d0f58c58ded0cba6b19211ebf15 Mon Sep 17 00:00:00 2001 From: dimw Date: Tue, 7 Sep 2021 11:04:15 +0000 Subject: [PATCH] Trim label names and values (#71) --- rancher_gitlab_deploy/cli.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/rancher_gitlab_deploy/cli.py b/rancher_gitlab_deploy/cli.py index a91a5d7..6655b38 100755 --- a/rancher_gitlab_deploy/cli.py +++ b/rancher_gitlab_deploy/cli.py @@ -239,8 +239,14 @@ def main( labels_as_array = labels.split(rancher_label_separator) for label_item in labels_as_array: - key, value = label_item.split("=", 1) - defined_labels[key] = value + label_item = label_item.strip() + + if label_item: + key, value = label_item.split("=", 1) + key = key.strip() + value = value.strip() + + defined_labels[key] = value if label: for item in label: @@ -280,7 +286,7 @@ def main( if secret_item: key, value = secret_item.split("=", 1) key = key.strip() - + defined_secrets.append({"type": "secretReference", "name": key}) if secret: