Project

General

Profile

Actions

Bug #30125

closed

hammer org add-provisioning-template command returns Error: undefined method `[]' for nil:NilClass

Added by Oleh Fedorenko over 4 years ago. Updated over 4 years ago.

Status:
Closed
Priority:
Normal
Category:
Provisioning templates
Target version:
-
Difficulty:
Triaged:
Yes
Team Backlog:
Fixed in Releases:
Found in Releases:
In Kanboard:

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


Related issues 1 (0 open1 closed)

Related to Hammer CLI - Bug #30938: Use parent resource instead of hardcoded oneClosedOleh FedorenkoActions
Actions

Also available in: Atom PDF