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 1296827

Summary: Error: undefined method `[]' for nil:NilClass when syncing contents to capsule by --name
Product: Red Hat Satellite Reporter: Sachin Ghai <sghai>
Component: HammerAssignee: satellite6-bugs <satellite6-bugs>
Status: CLOSED NOTABUG QA Contact: Sachin Ghai <sghai>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 6.2.0CC: abelopez, bkearney, sauchter, sghai
Target Milestone: UnspecifiedKeywords: Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-02-14 14:03:10 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:

Description Sachin Ghai 2016-01-08 08:48:18 UTC
Description of problem:

content-synchronization by capsule name throw following error:

[root@cloud-qe-20 yum.repos.d]# hammer -u admin capsule content synchronize --environment Dev --name cloud-qe-17.redhat.com  --organization-id 1
[Foreman] Password for admin: 
Could not synchronize capsule content:
  Error: undefined method `[]' for nil:NilClass



Version-Release number of selected component (if applicable):

ruby193-rubygem-foreman-tasks-0.6.15.7-1.el6_6sat.noarch
rubygem-hammer_cli_foreman_discovery-0.0.1.10-1.el6_6sat.noarch
foreman-ovirt-1.7.2.50-1.el6_6sat.noarch
rubygem-hammer_cli_foreman-0.1.4.15-1.el6.noarch
katello-common-2.2.0.17-1.el6_6sat.noarch
ruby193-rubygem-foreman-redhat_access-0.2.4-1.el6_6sat.noarch
ruby193-rubygem-foreman_discovery-2.0.0.23-1.el6_6sat.noarch
ruby193-rubygem-foreman_gutterball-0.0.1.9-1.el6_6sat.noarch
rubygem-hammer_cli_import-0.10.20-1.el6_6sat.noarch
cloud-qe-20.idmqe.lab.eng.bos.redhat.com-foreman-client-1.0-1.noarch
foreman-1.7.2.50-1.el6_6sat.noarch
foreman-libvirt-1.7.2.50-1.el6_6sat.noarch
foreman-proxy-1.7.2.8-1.el6.noarch
ruby193-rubygem-katello-2.2.0.80-1.el6_6sat.noarch
katello-service-2.2.0.17-1.el6_6sat.noarch
katello-certs-tools-2.2.1-1.el6_6sat.noarch
rubygem-hammer_cli-0.1.4.13-1.el6.noarch
rubygem-hammer_cli_gutterball-0.0.1.3-1.el6_6sat.noarch
katello-server-ca-1.0-1.noarch
cloud-qe-20.idmqe.lab.eng.bos.redhat.com-foreman-proxy-client-1.0-1.noarch
foreman-selinux-1.7.2.17-1.el6.noarch
ruby193-rubygem-foreman_bootdisk-4.0.2.14-1.el6_6sat.noarch
foreman-compute-1.7.2.50-1.el6_6sat.noarch
katello-installer-2.3.23-1.el6.noarch
foreman-gce-1.7.2.50-1.el6_6sat.noarch
rubygem-hammer_cli_katello-0.0.7.20-1.el6.noarch
katello-debug-2.2.0.17-1.el6_6sat.noarch
rubygem-hammer_cli_foreman_docker-0.0.3.10-1.el6.noarch
ruby193-rubygem-foreman_hooks-0.3.7-2.el6_6sat.noarch
rubygem-hammer_cli_foreman_tasks-0.0.3.5-1.el6_6sat.noarch
katello-default-ca-1.0-1.noarch
foreman-discovery-image-3.0.5-3.el7sat.noarch
pulp-katello-0.5-1.el6_6sat.noarch
katello-installer-base-2.3.23-1.el6.noarch
foreman-postgresql-1.7.2.50-1.el6_6sat.noarch
ruby193-rubygem-foreman_docker-1.2.0.24-1.el6_6sat.noarch
foreman-debug-1.7.2.50-1.el6_6sat.noarch
rubygem-hammer_cli_foreman_bootdisk-0.1.2.7-1.el6_6sat.noarch
foreman-vmware-1.7.2.50-1.el6_6sat.noarch
katello-2.2.0.17-1.el6_6sat.noarch

How reproducible:
always

Steps to Reproduce:
1. sync contents to capsule by capsule name
2.
3.

Actual results:
Could not synchronize capsule content:
  Error: undefined method `[]' for nil:NilClass


Expected results:
sync should run successfully

Additional info:
[ERROR 2016-01-08 03:47:37 Exception] Error: undefined method `[]' for nil:NilClass
Could not synchronize capsule content:
  Error: undefined method `[]' for nil:NilClass
[ERROR 2016-01-08 03:47:37 Exception] 

NoMethodError (undefined method `[]' for nil:NilClass):
    /usr/lib/ruby/gems/1.8/gems/apipie-bindings-0.0.11/lib/apipie_bindings/action.rb:27:in `routes'
    /usr/lib/ruby/gems/1.8/gems/hammer_cli_foreman-0.1.4.15/lib/hammer_cli_foreman/id_resolver.rb:175:in `route_options'
    /usr/lib/ruby/gems/1.8/gems/hammer_cli_foreman-0.1.4.15/lib/hammer_cli_foreman/id_resolver.rb:167:in `resolved_call'
    /usr/lib/ruby/gems/1.8/gems/hammer_cli_foreman-0.1.4.15/lib/hammer_cli_foreman/id_resolver.rb:155:in `find_resource'
    /usr/lib/ruby/gems/1.8/gems/hammer_cli_foreman-0.1.4.15/lib/hammer_cli_foreman/id_resolver.rb:139:in `get_id'
    /usr/lib/ruby/gems/1.8/gems/hammer_cli_foreman-0.1.4.15/lib/hammer_cli_foreman/id_resolver.rb:129:in `capsule_content_id'
    /usr/lib/ruby/gems/1.8/gems/hammer_cli_foreman-0.1.4.15/lib/hammer_cli_foreman/commands.rb:149:in `send'
    /usr/lib/ruby/gems/1.8/gems/hammer_cli_foreman-0.1.4.15/lib/hammer_cli_foreman/commands.rb:149:in `get_resource_id'
    /usr/lib/ruby/gems/1.8/gems/hammer_cli_foreman-0.1.4.15/lib/hammer_cli_foreman/commands.rb:138:in `get_identifier'
    /usr/lib/ruby/gems/1.8/gems/hammer_cli_foreman-0.1.4.15/lib/hammer_cli_foreman/commands.rb:230:in `customized_options'
    /usr/lib/ruby/gems/1.8/gems/hammer_cli_foreman-0.1.4.15/lib/hammer_cli_foreman/commands.rb:235:in `request_params'
    /usr/lib/ruby/gems/1.8/gems/hammer_cli-0.1.4.13/lib/hammer_cli/./apipie/command.rb:43:in `send_request'
    /usr/lib/ruby/gems/1.8/gems/hammer_cli_foreman-0.1.4.15/lib/hammer_cli_foreman/commands.rb:185:in `send_request'
    /usr/lib/ruby/gems/1.8/gems/hammer_cli_foreman_tasks-0.0.3.5/lib/hammer_cli_foreman_tasks/async_command.rb:14: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.1.4.13/lib/hammer_cli/./apipie/../abstract.rb:23: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.1.4.13/lib/hammer_cli/./apipie/../abstract.rb:23: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.1.4.13/lib/hammer_cli/./apipie/../abstract.rb:23: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.1.4.13/lib/hammer_cli/./apipie/../abstract.rb:23: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.1.4.13/bin/hammer:108
    /usr/bin/hammer:19:in `load'

Comment 2 Abel Lopez 2016-01-19 23:24:14 UTC
Saw this too, switching to --id is a workaround

Comment 5 Bryan Kearney 2016-07-26 15:25:24 UTC
Moving 6.2 bugs out to sat-backlog.

Comment 6 Bryan Kearney 2016-07-26 15:37:15 UTC
Moving 6.2 bugs out to sat-backlog.

Comment 9 Sachin Ghai 2017-02-14 09:26:24 UTC
Tested the issue with sat6.2.8 snap2

this issue is not reproducible w/ sat6.2.8 snap2

 ~]# hammer -u admin -p changeme capsule content synchronize --name qe-capsule-upgrade-rhel6.capqe.lab.eng.rdu2.redhat.com --organization-id 1 --environment Dev 
[............................................................................................................................................] [100%]

Comment 10 Bryan Kearney 2017-02-14 14:03:10 UTC
Closing per comment 9