Actions
Bug #28578
closedVariables can be nil when importing Ansible variables through the Foreman UI
Status:
Closed
Priority:
Normal
Assignee:
-
Target version:
-
Difficulty:
Triaged:
No
Bugzilla link:
Description
Ref: https://community.theforeman.org/t/openscap-plugin-with-ansible-role-variables-import-failed/16601
When attempting ansible variables import through the Foreman UI, there is a case where
clicking Configure > Ansible Variables > Import from Foreman will fail. The error that gets
thrown is the following:
*NoMethodError* **undefined method `map' for nil:NilClass** /opt/theforeman/tfm/root/usr/share/gems/gems/foreman_ansible-3.0.9/app/services/foreman_ansible/variables_importer.rb:48:in `initialize_variables' /opt/theforeman/tfm/root/usr/share/gems/gems/foreman_ansible-3.0.9/app/services/foreman_ansible/variables_importer.rb:34:in `block in import_variables' /opt/theforeman/tfm/root/usr/share/gems/gems/foreman_ansible-3.0.9/app/services/foreman_ansible/variables_importer.rb:31:in `each' /opt/theforeman/tfm/root/usr/share/gems/gems/foreman_ansible-3.0.9/app/services/foreman_ansible/variables_importer.rb:31:in `map' /opt/theforeman/tfm/root/usr/share/gems/gems/foreman_ansible-3.0.9/app/services/foreman_ansible/variables_importer.rb:31:in `import_variables' /opt/theforeman/tfm/root/usr/share/gems/gems/foreman_ansible-3.0.9/app/services/foreman_ansible/variables_importer.rb:25:in `import_variable_names'
I suspect it is the case when you have a mixture of roles that do and do not have default variables set. Need to find a way to make sure the UI ignores those nil variables.
Actions