Fix to gather facts include macro and tag (#66947)

This commit is contained in:
sky-joker 2020-01-31 00:07:40 +09:00 committed by GitHub
parent e3190adcbb
commit 72e1716f29
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -125,8 +125,15 @@ class Host(object):
search_key = 'search' search_key = 'search'
if exact_match: if exact_match:
search_key = 'filter' search_key = 'filter'
host_list = self._zapi.host.get({'output': 'extend', 'selectParentTemplates': ['name'], search_key: {'host': [host_name]}, host_list = self._zapi.host.get({
'selectInventory': host_inventory, 'selectGroups': 'extend'}) 'output': 'extend',
'selectParentTemplates': ['name'],
search_key: {'host': [host_name]},
'selectInventory': host_inventory,
'selectGroups': 'extend',
'selectTags': 'extend',
'selectMacros': 'extend'
})
if len(host_list) < 1: if len(host_list) < 1:
self._module.fail_json(msg="Host not found: %s" % host_name) self._module.fail_json(msg="Host not found: %s" % host_name)
else: else:
@ -149,7 +156,9 @@ class Host(object):
'selectGroups': 'extend', 'selectGroups': 'extend',
'selectParentTemplates': ['name'], 'selectParentTemplates': ['name'],
'hostids': hostinterface['hostid'], 'hostids': hostinterface['hostid'],
'selectInventory': host_inventory 'selectInventory': host_inventory,
'selectTags': 'extend',
'selectMacros': 'extend'
}) })
host[0]['hostinterfaces'] = hostinterface host[0]['hostinterfaces'] = hostinterface
host_list.append(host[0]) host_list.append(host[0])