Browse code

Properly restrict hosts after 9070875

Daniel Hokka Zakrisson authored on 2012/11/29 06:03:23
Showing 1 changed files
... ...
@@ -239,10 +239,10 @@ class PlayBook(object):
239 239
 
240 240
     # *****************************************************
241 241
 
242
-    def _list_available_hosts(self):
242
+    def _list_available_hosts(self, *args):
243 243
         ''' returns a list of hosts that haven't failed and aren't dark '''
244 244
 
245
-        return [ h for h in self.inventory.list_hosts() if (h not in self.stats.failures) and (h not in self.stats.dark)]
245
+        return [ h for h in self.inventory.list_hosts(*args) if (h not in self.stats.failures) and (h not in self.stats.dark)]
246 246
 
247 247
     # *****************************************************
248 248
 
... ...
@@ -347,7 +347,7 @@ class PlayBook(object):
347 347
     def _do_setup_step(self, play):
348 348
         ''' get facts from the remote system '''
349 349
 
350
-        host_list = self._list_available_hosts()
350
+        host_list = self._list_available_hosts(play.hosts)
351 351
 
352 352
         if play.gather_facts is False:
353 353
             return {}
... ...
@@ -396,7 +396,7 @@ class PlayBook(object):
396 396
 
397 397
         # now with that data, handle contentional variable file imports!
398 398
 
399
-        all_hosts = self._list_available_hosts()
399
+        all_hosts = self._list_available_hosts(play.hosts)
400 400
         play.update_vars_files(all_hosts)
401 401
 
402 402
         serialized_batch = []
... ...
@@ -431,7 +431,7 @@ class PlayBook(object):
431 431
                         # just didn't match anything and that's ok
432 432
                         return False
433 433
 
434
-                host_list = self._list_available_hosts()
434
+                host_list = self._list_available_hosts(play.hosts)
435 435
 
436 436
                 # if no hosts remain, drop out
437 437
                 if not host_list: