Fix inventory script for Foreman where group by pattern are not prope… (#25173)
* Fix inventory script for Foreman where group by pattern are not properly safe-guarded. * Fix pep8 error about tab mixed with blanks.pull/4420/head
parent
b7662f7e5b
commit
eb53f3c129
|
@ -262,12 +262,9 @@ class ForemanInventory(object):
|
||||||
|
|
||||||
# Ansible groups by parameters in host groups and Foreman host
|
# Ansible groups by parameters in host groups and Foreman host
|
||||||
# attributes.
|
# attributes.
|
||||||
groupby = copy.copy(params)
|
groupby = dict()
|
||||||
for k, v in host.items():
|
for k, v in params.items():
|
||||||
if isinstance(v, str):
|
groupby[k] = self.to_safe(str(v))
|
||||||
groupby[k] = self.to_safe(v)
|
|
||||||
elif isinstance(v, int):
|
|
||||||
groupby[k] = v
|
|
||||||
|
|
||||||
# The name of the ansible groups is given by group_patterns:
|
# The name of the ansible groups is given by group_patterns:
|
||||||
for pattern in self.group_patterns:
|
for pattern in self.group_patterns:
|
||||||
|
|
Loading…
Reference in New Issue