Use . instead of source

On some platforms, including Ubuntu, sh is the default shell rather than bash. sh only
supports . for sourcing files, not the source keyword.
This commit is contained in:
Mark Goddard 2017-09-07 18:38:08 +01:00
parent c60c07b191
commit 8d544221bb
2 changed files with 7 additions and 7 deletions

View File

@ -104,7 +104,7 @@ def build_args(parsed_args, command, inventory_filename, extra_vars=None,
tags=None, verbose_level=None, extra_args=None, limit=None):
"""Build arguments required for running Kolla Ansible."""
venv_activate = os.path.join(parsed_args.kolla_venv, "bin", "activate")
cmd = ["source", venv_activate, "&&"]
cmd = [".", venv_activate, "&&"]
cmd += ["kolla-ansible", command]
if verbose_level:
cmd += ["-" + "v" * verbose_level]

View File

@ -35,7 +35,7 @@ class TestCase(unittest.TestCase):
parsed_args = parser.parse_args([])
kolla_ansible.run(parsed_args, "command", "overcloud")
expected_cmd = [
"source", "/opt/kayobe/venvs/kolla/bin/activate", "&&",
".", "/opt/kayobe/venvs/kolla/bin/activate", "&&",
"kolla-ansible", "command",
"--inventory", "/etc/kolla/inventory/overcloud",
]
@ -58,7 +58,7 @@ class TestCase(unittest.TestCase):
parsed_args = parser.parse_args(args)
kolla_ansible.run(parsed_args, "command", "overcloud")
expected_cmd = [
"source", "/opt/kayobe/venvs/kolla/bin/activate", "&&",
".", "/opt/kayobe/venvs/kolla/bin/activate", "&&",
"kolla-ansible", "command",
"--inventory", "/path/to/inventory",
"--configdir", "/path/to/config",
@ -87,7 +87,7 @@ class TestCase(unittest.TestCase):
parsed_args = parser.parse_args(args)
kolla_ansible.run(parsed_args, "command", "overcloud")
expected_cmd = [
"source", "/opt/kayobe/venvs/kolla/bin/activate", "&&",
".", "/opt/kayobe/venvs/kolla/bin/activate", "&&",
"kolla-ansible", "command",
"--inventory", "/path/to/inventory",
"--configdir", "/path/to/config",
@ -111,7 +111,7 @@ class TestCase(unittest.TestCase):
parsed_args = parser.parse_args(args)
kolla_ansible.run(parsed_args, "command", "overcloud")
expected_cmd = [
"source", "/opt/kayobe/venvs/kolla/bin/activate", "&&",
".", "/opt/kayobe/venvs/kolla/bin/activate", "&&",
"kolla-ansible", "command",
"--key", "/path/to/vault/pw",
"--inventory", "/etc/kolla/inventory/overcloud",
@ -134,7 +134,7 @@ class TestCase(unittest.TestCase):
parsed_args = parser.parse_args([])
kolla_ansible.run(parsed_args, "command", "overcloud")
expected_cmd = [
"source", "/opt/kayobe/venvs/kolla/bin/activate", "&&",
".", "/opt/kayobe/venvs/kolla/bin/activate", "&&",
"kolla-ansible", "command",
"--key", "/path/to/kayobe-vault-password-helper",
"--inventory", "/etc/kolla/inventory/overcloud",
@ -161,7 +161,7 @@ class TestCase(unittest.TestCase):
}
kolla_ansible.run(parsed_args, "command", "overcloud", **kwargs)
expected_cmd = [
"source", "/opt/kayobe/venvs/kolla/bin/activate", "&&",
".", "/opt/kayobe/venvs/kolla/bin/activate", "&&",
"kolla-ansible", "command",
"-v",
"--inventory", "/etc/kolla/inventory/overcloud",