Closed mrjk closed 2 years ago
The short version is: your Foreman is too old and we don't support it anymore.
The longer is: Foreman introduced typed parameters in either 1.22 or 1.24 and the API would return the type correctly since. We do inject type=string for parameters coming from a playbook, if nothing else is set, but try not to guess what's in Foreman.
Your hack seems to solve the issue for you, so feel free to use it, but we would prefer not to carry around workarounds for such old Foreman versions.
Hey @evgeni , thanks for your quick answer.
I'm agree with you in the sense of our instance is way too old to be supported. However, from a coder perspective, I guess it would be also a good idea to have a string
as default type when the parameter_type
is missing :p
Anyway, thanks for your support, I'll keep my hack until we'll update our Foreman instance.
SUMMARY
Module
theforeman.foreman.host
fails when a parameter is set inHost Parameters
in Foreman. It may also impact more modules in different conditions.ISSUE TYPE
ANSIBLE VERSION
I explicitly mention this is Python 3.10. I know those module does not support (yet) this version, but it's worth mention it.
COLLECTION VERSION
KATELLO/FOREMAN VERSION
I know this version is quite old.
STEPS TO REPRODUCE
To reproduce this bug, go into any Foreman host in the Web UI, click
Edit
, in theParameters
tab, there is aHost Parameters
section. Ansible Host module will crash if any parameter is set here.EXPECTED RESULTS
The module should not crash when a Host Parameter is set.
ACTUAL RESULTS
There is below a formatted trace:
TECHNICAL ANALYSIS
As we can see, it's
inforeman_helper.py
line 1741, inparameters_list_to_str_list
function. It seems that new_param does not have a['parameter_type']
attribute.If I monkey patch the 1741 line:
It solves the issue. However, it's probably not the correct fix to apply, as it should be applied at the object creation.
NOTES
I'm not sure about anything except the technical explanation. I'm not sure about my Foreman instance reliability, the problem may be somewhere else also and impact all module using this function.