Permalink
Browse files

Gracefully handle being passed a list of host as a host_range

  • Loading branch information...
1 parent 53aa781 commit 3416bbd6492d72014274a0105b70d54579e326d4 dhubbard committed Aug 6, 2013
Showing with 7 additions and 1 deletion.
  1. +7 −1 sshmap/sshmap.py
View
@@ -442,7 +442,13 @@ def run(host_range, command, username=None, password=None, sudo=False,
'completed_host_count': 1}
"""
utility.status_info(output_callback, 'Looking up hosts')
- hosts = hostlists.expand(hostlists.range_split(host_range))
+
+ # Expand the host range if we were passed a string host list
+ if isinstance(host_range, [unicode, str]):
+ hosts = hostlists.expand(hostlists.range_split(host_range))
+ else:
+ hosts = host_range
+
if shuffle:
random.shuffle(hosts)
utility.status_clear()

0 comments on commit 3416bbd

Please sign in to comment.