CI: Fix ansible-lint failure
Currently ansible-lint is failing with: KeyError: 'hostvars' This change fixes the issue by making the hostvars key optional. This should not affect real usage, since an error is raised in this case. Change-Id: I6dd482e95fa4f5508452d83bb64613d55eb1985f
This commit is contained in:
parent
6d1fa48bca
commit
c9515e0ca8
@ -56,7 +56,7 @@ def _get_hostvar(context, var_name, inventory_hostname=None):
|
||||
if inventory_hostname is None:
|
||||
namespace = context
|
||||
else:
|
||||
if inventory_hostname not in context['hostvars']:
|
||||
if inventory_hostname not in context.get('hostvars', []):
|
||||
raise AnsibleFilterError(
|
||||
"Inventory hostname '%s' not in hostvars" % inventory_hostname)
|
||||
namespace = context['hostvars'][inventory_hostname]
|
||||
|
Loading…
x
Reference in New Issue
Block a user