Skip to content

Commit

Permalink
Make env a commandline option instead of a fabric task
Browse files Browse the repository at this point in the history
  • Loading branch information
tobami committed Nov 11, 2011
1 parent 88a7d03 commit fe23f25
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions fix
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions tests/test_command.py
Expand Up @@ -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)

Expand Down

0 comments on commit fe23f25

Please sign in to comment.