Merge pull request #2001 from stoned/ansible-limit-list-hosts

For ansible --list-hosts benefit apply hosts selection limits early
This commit is contained in:
Daniel Hokka Zakrisson 2013-02-06 23:09:18 -08:00
commit 43c9a665e1

View file

@ -70,6 +70,8 @@ class Cli(object):
pattern = args[0] pattern = args[0]
inventory_manager = inventory.Inventory(options.inventory) inventory_manager = inventory.Inventory(options.inventory)
if options.subset:
inventory_manager.subset(options.subset)
hosts = inventory_manager.list_hosts(pattern) hosts = inventory_manager.list_hosts(pattern)
if len(hosts) == 0: if len(hosts) == 0:
print >>sys.stderr, "No hosts matched" print >>sys.stderr, "No hosts matched"