Quote kolla limit when calling kolla-ansible

This is necessary for correctly passing limits containing special
characters such as ~ or &.

Change-Id: Ia885a226de30d72610dca2eb2f194cef10193095
Story: 2008546
Task: 41651
This commit is contained in:
Pierre Riteau 2021-01-21 17:12:07 +01:00
parent 4d96568912
commit a1c9a81525
3 changed files with 8 additions and 3 deletions

View File

@ -132,7 +132,7 @@ def build_args(parsed_args, command, inventory_filename, extra_vars=None,
cmd += ["-e", "%s=%s" % (extra_var_name, extra_var_value)]
if parsed_args.kolla_limit or limit:
limit_arg = utils.intersect_limits(parsed_args.kolla_limit, limit)
cmd += ["--limit", limit_arg]
cmd += ["--limit", utils.quote_and_escape(limit_arg)]
if parsed_args.kolla_skip_tags:
cmd += ["--skip-tags", parsed_args.kolla_skip_tags]
if parsed_args.kolla_tags or tags:

View File

@ -69,7 +69,7 @@ class TestCase(unittest.TestCase):
"--configdir", "/path/to/config",
"--passwords", "/path/to/config/passwords.yml",
"-e", "ev_name1=ev_value1",
"--limit", "host1:host2",
"--limit", "'host1:host2'",
"--tags", "tag1,tag2",
]
expected_cmd = " ".join(expected_cmd)
@ -105,7 +105,7 @@ class TestCase(unittest.TestCase):
"--configdir", "/path/to/config",
"--passwords", "/path/to/config/passwords.yml",
"-e", "ev_name1=ev_value1",
"--limit", "host1:host2",
"--limit", "'host1:host2'",
"--skip-tags", "tag3,tag4",
"--tags", "tag1,tag2",
]

View File

@ -0,0 +1,5 @@
---
fixes:
- |
Fixes calls to ``kolla-ansible`` when arguments to ``--kolla-limit``
contain special characters such as ``~`` or ``&``.