Bug #30125
closedhammer org add-provisioning-template command returns Error: undefined method `[]' for nil:NilClass
Description
Cloned from https://bugzilla.redhat.com/show_bug.cgi?id=1845860
Description of problem:
the `hammer org add-provisioning-template` command doesn't seem to work at all.
None of the
--provisioning-template[-id]
--provisioning-template-ids
--provisioning-template-search
--provisioning-templates
options work (the search for the given provisioning templates works as intended, but the final PUT request to the traget org throws an error)
NoMethodError (undefined method `[]' for nil:NilClass):
/opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_foreman-2.1.0/lib/hammer_cli_foreman/associating_commands.rb:248:in `request_params'
/opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-2.1.0/lib/hammer_cli/apipie/command.rb:98:in `extended_request'
/opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-2.1.0/lib/hammer_cli/apipie/command.rb:53:in `send_request'
/opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_foreman-2.1.0/lib/hammer_cli_foreman/commands.rb:188:in `send_request'
/opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-2.1.0/lib/hammer_cli/apipie/command.rb:34:in `execute'
/opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.1.2/lib/clamp/command.rb:63:in `run'
/opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-2.1.0/lib/hammer_cli/abstract.rb:77:in `run'
/opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.1.2/lib/clamp/subcommand/execution.rb:11:in `execute'
/opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.1.2/lib/clamp/command.rb:63:in `run'
/opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-2.1.0/lib/hammer_cli/abstract.rb:77:in `run'
/opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.1.2/lib/clamp/subcommand/execution.rb:11:in `execute'
/opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.1.2/lib/clamp/command.rb:63:in `run'
/opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-2.1.0/lib/hammer_cli/abstract.rb:77:in `run'
/opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.1.2/lib/clamp/command.rb:132:in `run'
/opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-2.1.0/bin/hammer:147:in `<top (required)>'
/usr/bin/hammer:23:in `load'
/usr/bin/hammer:23:in `<main>'
the debug output shows that the provisioning template was retrieved:
[ INFO 2020-06-10T05:30:00 HammerCLIForeman::Organization::OrganizationAddProvisioningTemplateCommand] Called with options: {"option_id"=>"1", "option_provisioning_template_ids"=>[186], "option_provisioning_template_names"=>["foo"]}
Version-Release number of selected component (if applicable):
6.8.0-3
How reproducible:
always
Steps to Reproduce:
1. create new org
2. create new provisioning template of any type and assign it to Default Org only
3. try to assign the new provisioning template with the new org using hammer:
hammer -d org add-provisioning-template --id <new_org_id> --provisioning-templates <new_ptemplate_name>
Actual results:
NoMethodError (undefined method `[]' for nil:NilClass)
Expected results:
just works