Fixes #4979 Check for the correct context when inside the inventory_hostnames plugin
This commit is contained in:
parent
903c4cae7b
commit
b8146e3bc7
1 changed files with 4 additions and 1 deletions
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue