Merge "Quote kolla limit when calling kolla-ansible"

This commit is contained in:
Zuul 2021-03-01 18:58:44 +00:00 committed by Gerrit Code Review
commit a4919e1877
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)] cmd += ["-e", "%s=%s" % (extra_var_name, extra_var_value)]
if parsed_args.kolla_limit or limit: if parsed_args.kolla_limit or limit:
limit_arg = utils.intersect_limits(parsed_args.kolla_limit, 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: if parsed_args.kolla_skip_tags:
cmd += ["--skip-tags", parsed_args.kolla_skip_tags] cmd += ["--skip-tags", parsed_args.kolla_skip_tags]
if parsed_args.kolla_tags or tags: if parsed_args.kolla_tags or tags:

View File

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