Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
Red Hat Satellite engineering is moving the tracking of its product development work on Satellite to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "Satellite project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs will be migrated starting at the end of May. If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "Satellite project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/SAT-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 1049829

Summary: CLI : hammer cli command `os add_configtemplate` fails
Product: Red Hat Satellite Reporter: Tazim Kolhar <tkolhar>
Component: ProvisioningAssignee: Martin Bacovsky <mbacovsk>
Status: CLOSED CURRENTRELEASE QA Contact: Tazim Kolhar <tkolhar>
Severity: medium Docs Contact:
Priority: unspecified    
Version: NightlyCC: cwelton, dcleal, gkhachik, ohadlevy, omaciel, tstrachota
Target Milestone: UnspecifiedKeywords: Triaged
Target Release: Unused   
Hardware: x86_64   
OS: Linux   
URL: http://projects.theforeman.org/issues/3922
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-07-02 14:08:45 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
foreman-debug none

Description Tazim Kolhar 2014-01-08 10:20:28 UTC
Description of problem:
 hammer cli command `os add_configtemplate` fails

Version-Release number of selected component (if applicable):
# rpm -qa | grep foreman
rubygem-foreman_api-0.1.9-1.el6.noarch
foreman-compute-1.4.0-0.develop.201401071212git9ef39dd.el6.noarch
foreman-libvirt-1.4.0-0.develop.201401071212git9ef39dd.el6.noarch
foreman-postgresql-1.4.0-0.develop.201401071212git9ef39dd.el6.noarch
foreman-selinux-1.4.0-0.develop.201311220906gite342a0b.el6.noarch
rubygem-hammer_cli_foreman-0.0.15-1.el6.noarch
foreman-1.4.0-0.develop.201401071212git9ef39dd.el6.noarch
foreman-ovirt-1.4.0-0.develop.201401071212git9ef39dd.el6.noarch
foreman-installer-1.4.0-0.develop.201401031335gitf3eee21.el6.noarch
foreman-release-1.4.0-0.develop.201401071212git9ef39dd.el6.noarch
foreman-proxy-1.4.0-0.develop.201401031522gitd3509e6.el6.noarch


How reproducible:
everytime

Steps to Reproduce:
1.#  hammer os add_configtemplate --id 1 --name testos --configtemplate testx
Error: undefined method `[]' for nil:NilClass
2.
3.

Actual results:
The command execution fails

Expected results:
The command execution should work as expected

Additional info:

Comment 1 Tazim Kolhar 2014-01-08 10:29:52 UTC
Created attachment 847050 [details]
foreman-debug

Comment 2 RHEL Program Management 2014-01-08 10:36:27 UTC
Since this issue was entered in Red Hat Bugzilla, the release flag has been
set to ? to ensure that it is properly evaluated for this release.

Comment 4 Tazim Kolhar 2014-01-08 10:40:46 UTC
#  hammer --verbose os add_configtemplate --id 1 --name testos --configtemplate testx
[ INFO 2014-01-08 05:40:16 Init] Initialization of Hammer CLI (0.0.14) has started...
[ INFO 2014-01-08 05:40:16 Init] Configuration from the file /etc/foreman/cli_config.yml has been loaded
[ INFO 2014-01-08 05:40:16 Modules] Extension module hammer_cli_foreman (0.0.15) loaded
[ INFO 2014-01-08 05:40:16 HammerCLI::MainCommand] Called with options: {"verbose"=>true}
[ INFO 2014-01-08 05:40:16 HammerCLIForeman::OperatingSystem] Called with options: {}
[ INFO 2014-01-08 05:40:16 HammerCLIForeman::AssociatingCommands::ConfigTemplate::AddConfigTemplateCommand] Called with options: {"associated_name"=>"testx", "id"=>"1", "name"=>"testos"}
[ERROR 2014-01-08 05:40:16 Exception] Error: undefined method `[]' for nil:NilClass
Error: undefined method `[]' for nil:NilClass
[ERROR 2014-01-08 05:40:16 Exception] 

NoMethodError (undefined method `[]' for nil:NilClass):
    /usr/lib/ruby/gems/1.8/gems/hammer_cli_foreman-0.0.15/lib/hammer_cli_foreman/commands.rb:256:in `get_current_ids'
    /usr/lib/ruby/gems/1.8/gems/hammer_cli_foreman-0.0.15/lib/hammer_cli_foreman/commands.rb:284:in `get_new_ids'
    /usr/lib/ruby/gems/1.8/gems/hammer_cli_foreman-0.0.15/lib/hammer_cli_foreman/commands.rb:266:in `request_params'
    /usr/lib/ruby/gems/1.8/gems/hammer_cli_foreman-0.0.15/lib/hammer_cli_foreman/commands.rb:34:in `send_request'
    /usr/lib/ruby/gems/1.8/gems/hammer_cli-0.0.14/lib/hammer_cli/./apipie/write_command.rb:10:in `execute'
    /usr/lib/ruby/gems/1.8/gems/clamp-0.6.2/lib/clamp/command.rb:67:in `run'
    /usr/lib/ruby/gems/1.8/gems/hammer_cli-0.0.14/lib/hammer_cli/abstract.rb:22:in `run'
    /usr/lib/ruby/gems/1.8/gems/clamp-0.6.2/lib/clamp/subcommand/execution.rb:11:in `execute'
    /usr/lib/ruby/gems/1.8/gems/clamp-0.6.2/lib/clamp/command.rb:67:in `run'
    /usr/lib/ruby/gems/1.8/gems/hammer_cli-0.0.14/lib/hammer_cli/abstract.rb:22:in `run'
    /usr/lib/ruby/gems/1.8/gems/clamp-0.6.2/lib/clamp/subcommand/execution.rb:11:in `execute'
    /usr/lib/ruby/gems/1.8/gems/clamp-0.6.2/lib/clamp/command.rb:67:in `run'
    /usr/lib/ruby/gems/1.8/gems/hammer_cli-0.0.14/lib/hammer_cli/abstract.rb:22:in `run'
    /usr/lib/ruby/gems/1.8/gems/clamp-0.6.2/lib/clamp/command.rb:125:in `run'
    /usr/lib/ruby/gems/1.8/gems/hammer_cli-0.0.14/bin/hammer:61
    /usr/bin/hammer:19:in `load'
    /usr/bin/hammer:19

Comment 5 Tazim Kolhar 2014-01-08 10:41:58 UTC
*** Bug 1049832 has been marked as a duplicate of this bug. ***

Comment 6 Tazim Kolhar 2014-01-08 10:42:23 UTC
*** Bug 1049836 has been marked as a duplicate of this bug. ***

Comment 7 Garik Khachikyan 2014-01-08 10:54:45 UTC
QA_ACK + requested the dev one. thx

Comment 11 Tazim Kolhar 2014-05-09 11:27:51 UTC
VERIFIED:

# hammer template create --name testtemp --operatingsystem-ids 1 --file '/root/test.txt' --type snippet
Config template created

Comment 12 Bryan Kearney 2014-07-02 14:08:45 UTC
This was delivered with 6.0.3, which is the Satellite 6 Beta.

Comment 13 Bryan Kearney 2014-07-02 14:10:11 UTC
This was delivered in 6.0.3, the Beta version of Satellite 6.0