Commit b8146e3b by James Tanner

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

parent 903c4cae
......@@ -34,7 +34,10 @@ class LookupModule(object):
def __init__(self, basedir=None, **kwargs):
self.basedir = basedir
self.host_list = kwargs['runner'].inventory.host_list
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)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment