mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-04-10 19:01:14 +00:00
Fixes #4979 Check for the correct context when inside the inventory_hostnames plugin
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user