Skip to content

Commit b1dfa95

Browse files
committedMar 22, 2021
fix(k8sworker): tags
Signed-off-by: Chris Snow <[email protected]>
1 parent 63fe827 commit b1dfa95

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed
 

‎hpecp/cli/k8sworker.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,8 @@ def create_with_ssh_key(
7373
ssh_key_file : str, optional
7474
The SSH key file path, by default None
7575
tags : list, optional
76-
Tags to use, e.g. /api/v2/tag/1:foo,/api/v2/tag/1:bar, by default None
76+
Tags to use, e.g. /api/v2/tag/1:foo,/api/v2/tag/1:bar,
77+
by default None
7778
ephemeral_disks : str
7879
Comma separated string containing ephemeral disks.
7980
e.g: "/dev/nvme2n1,/dev/nvme2n2"
@@ -93,7 +94,10 @@ def create_with_ssh_key(
9394

9495
if ssh_key is not None and ssh_key_file is not None:
9596
print(
96-
"Either ssh_key or ssh_key_file must be provided, but not both.",
97+
(
98+
"Either ssh_key or ssh_key_file must be provided,"
99+
" but not both."
100+
),
97101
file=sys.stderr,
98102
)
99103
sys.exit(1)
@@ -125,7 +129,9 @@ def create_with_ssh_key(
125129

126130
tags_parsed = []
127131
if tags is not None:
128-
tags_parsed = [dict(item.split(":") for item in tags.split(","))]
132+
for tag in tags.split(","):
133+
k, v = tag.split(":")
134+
tags_parsed.append({"tag_id": k, "tag_value": v})
129135

130136
worker_id = base.get_client().k8s_worker.create_with_ssh_key(
131137
ip=ip,

0 commit comments

Comments
 (0)
Please sign in to comment.