Fixes #4979 Check for the correct context when inside the inventory_hostnames plugin

This commit is contained in:
James Tanner 2013-11-25 10:57:10 -05:00
parent 903c4cae7b
commit b8146e3bc7

View file

@ -34,7 +34,10 @@ class LookupModule(object):
def __init__(self, basedir=None, **kwargs):
self.basedir = basedir
if 'runner' in kwargs:
self.host_list = kwargs['runner'].inventory.host_list
else:
raise errors.AnsibleError("inventory_hostnames must be used as a loop. Example: \"with_inventory_hostnames: \'all\'\"")
def run(self, terms, inject=None, **kwargs):
terms = utils.listify_lookup_plugin_terms(terms, self.basedir, inject)