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.
This commit is contained in:
parent
b7662f7e5b
commit
eb53f3c129
1 changed files with 3 additions and 6 deletions
|
@ -262,12 +262,9 @@ class ForemanInventory(object):
|
|||
|
||||
# Ansible groups by parameters in host groups and Foreman host
|
||||
# attributes.
|
||||
groupby = copy.copy(params)
|
||||
for k, v in host.items():
|
||||
if isinstance(v, str):
|
||||
groupby[k] = self.to_safe(v)
|
||||
elif isinstance(v, int):
|
||||
groupby[k] = v
|
||||
groupby = dict()
|
||||
for k, v in params.items():
|
||||
groupby[k] = self.to_safe(str(v))
|
||||
|
||||
# The name of the ansible groups is given by group_patterns:
|
||||
for pattern in self.group_patterns:
|
||||
|
|
Loading…
Reference in a new issue