From fe23f25b0f637633f99af5b224c2c2382be97e9b Mon Sep 17 00:00:00 2001 From: Miquel Torres Date: Fri, 11 Nov 2011 14:36:48 +0100 Subject: [PATCH] Make env a commandline option instead of a fabric task --- fix | 4 ++-- tests/test_command.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/fix b/fix index cf90669..34e9593 100755 --- a/fix +++ b/fix @@ -47,8 +47,8 @@ else: littlechef.loglevel = 'debug' sys.argv.remove('--debug') for arg in sys.argv: - if "env:" in arg: - chef_environment = arg.split(":")[1] + if "--env=" in arg: + chef_environment = arg.split("=")[1] if chef_environment == '': print("Error: No environment was given", file=sys.stderr) sys.exit(1) diff --git a/tests/test_command.py b/tests/test_command.py index 42b59e3..b0ca40e 100644 --- a/tests/test_command.py +++ b/tests/test_command.py @@ -87,13 +87,13 @@ def test_list_commands(self): class TestEnvironment(BaseTest): def test_no_value(self): """Should error out when the env value is empty""" - resp, error = self.execute([fix, 'list_nodes', 'env:']) + resp, error = self.execute([fix, 'list_nodes', '--env=']) self.assertEquals(resp, "") self.assertTrue("Error: No environment was given" in error, error) def test_valid_environment(self): """Should set the chef_environment value when one is given""" - resp, error = self.execute([fix, 'list_nodes', 'env:staging']) + resp, error = self.execute([fix, 'list_nodes', '--env=staging']) self.assertEquals(error, "", error) self.assertTrue("Environment: staging" in resp, resp)