Skip to content
Browse files

Switch up re #681 to be nice and not complain

  • Loading branch information...
1 parent 7716817 commit 87a79b3c7a8232748714d746a1296419334cfcc7 @bitprophet bitprophet committed
Showing with 5 additions and 9 deletions.
  1. +3 −6 fabric/task_utils.py
  2. +2 −3 tests/test_main.py
View
9 fabric/task_utils.py
@@ -44,12 +44,9 @@ 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)
- ))
-
+ # Coerce strings to one-item lists
+ if isinstance(hosts, basestring):
+ hosts = [hosts]
# Look up roles, turn into flat list of hosts
role_hosts = []
View
5 tests/test_main.py
@@ -300,12 +300,11 @@ def test_aborts_on_nonexistent_roles():
"""
merge([], ['badrole'], [], {})
-@aborts
-def test_aborts_on_non_list_hosts():
+def test_accepts_non_list_hosts():
"""
Aborts if hosts is a string, not a list
"""
- merge('badhosts', [], [], {})
+ assert merge('badhosts', [], [], {}) == ['badhosts']
lazy_role = {'r1': lambda: ['a', 'b']}

0 comments on commit 87a79b3

Please sign in to comment.
Something went wrong with that request. Please try again.