From 8d544221bb9265c8079b42badcc23c7bebf1fe32 Mon Sep 17 00:00:00 2001 From: Mark Goddard Date: Thu, 7 Sep 2017 18:38:08 +0100 Subject: [PATCH] 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. --- kayobe/kolla_ansible.py | 2 +- kayobe/tests/unit/test_kolla_ansible.py | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/kayobe/kolla_ansible.py b/kayobe/kolla_ansible.py index 60d62f97e..3819735ae 100644 --- a/kayobe/kolla_ansible.py +++ b/kayobe/kolla_ansible.py @@ -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] diff --git a/kayobe/tests/unit/test_kolla_ansible.py b/kayobe/tests/unit/test_kolla_ansible.py index c9c101ae9..78de660be 100644 --- a/kayobe/tests/unit/test_kolla_ansible.py +++ b/kayobe/tests/unit/test_kolla_ansible.py @@ -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",