Skip to content

Commit 53b9fd4

Browse files
committed
feat: enable repeated arguments in pvesh
Corresponding to parameters that are lists, eg in cluster/mapping/dir where map parameter is a list
1 parent e705e81 commit 53b9fd4

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

module_utils/pvesh.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,11 @@ def run_command(handler, resource, **params):
2525
handler,
2626
resource,
2727
"--output=json"]
28-
for parameter, value in params.items():
29-
command += ["-{}".format(parameter), "{}".format(value)]
28+
for parameter, values in params.items():
29+
if not isinstance(values, list):
30+
values = [values]
31+
for value in values:
32+
command += ["--{}".format(parameter), "{}".format(value)]
3033

3134
pipe = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
3235
(result, stderr) = pipe.communicate()

0 commit comments

Comments
 (0)