Permalink
Browse files

Abort when env.hosts=<str> re #861

  • Loading branch information...
1 parent 434fa9e commit 90680b2ff0c0ca12ce073ea45d0e07bad415df95 @bitprophet bitprophet committed Mar 19, 2013
Showing with 14 additions and 0 deletions.
  1. +7 −0 fabric/task_utils.py
  2. +7 −0 tests/test_main.py
@@ -44,6 +44,13 @@ def merge(hosts, roles, exclude, roledefs):
indent(bad_roles)
))
+ # Abort if hosts is a str and not the proper list format
+ if isinstance(hosts, basestring) :
+ abort("The following hosts list is a string, not the expected list: %s" % (
+ indent(hosts)
+ ))
+
+
# Look up roles, turn into flat list of hosts
role_hosts = []
for role in roles:
View
@@ -300,6 +300,13 @@ def test_aborts_on_nonexistent_roles():
"""
merge([], ['badrole'], [], {})
+@aborts
+def test_aborts_on_non_list_hosts():
+ """
+ Aborts if hosts is a string, not a list
+ """
+ merge('badhosts', [], [], {})
+
lazy_role = {'r1': lambda: ['a', 'b']}

0 comments on commit 90680b2

Please sign in to comment.