Bug 1456559

Summary: capsule content synchronize result to error "undefined method `download_policy' for nil:NilClass"
Product: Red Hat Satellite Reporter: Djebran Lezzoum <dlezzoum>
Component: Capsule - ContentAssignee: Justin Sherrill <jsherril>
Status: CLOSED ERRATA QA Contact: jcallaha
Severity: high Docs Contact:
Priority: unspecified    
Version: 6.2.10CC: bbuckingham, egolov, jcallaha, jsherril, sghai
Target Milestone: UnspecifiedKeywords: Regression, Triaged
Target Release: Unused   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: rubygem-katello-3.0.0.136-1 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-06-20 17:24:24 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 output
none
verification screenshot none

Description Djebran Lezzoum 2017-05-29 15:05:28 UTC
Created attachment 1283279 [details]
foreman  debug output

Description of problem:
capsule content synchronize result to error "undefined method `download_policy' for nil:NilClass"

Version-Release number of selected component (if applicable):
* candlepin-0.9.54.21-1.el7.noarch
* candlepin-selinux-0.9.54.21-1.el7.noarch
* foreman-1.11.0.76-1.el7sat.noarch
* foreman-compute-1.11.0.76-1.el7sat.noarch
* foreman-debug-1.11.0.76-1.el7sat.noarch
* foreman-discovery-image-3.1.1-23.el7sat.noarch
* foreman-ec2-1.11.0.76-1.el7sat.noarch
* foreman-gce-1.11.0.76-1.el7sat.noarch
* foreman-installer-1.11.0.15-2.el7sat.noarch
* foreman-installer-katello-3.0.0.84-1.el7sat.noarch
* foreman-libvirt-1.11.0.76-1.el7sat.noarch
* foreman-openstack-1.11.0.76-1.el7sat.noarch
* foreman-ovirt-1.11.0.76-1.el7sat.noarch
* foreman-postgresql-1.11.0.76-1.el7sat.noarch
* foreman-proxy-1.11.0.7-1.el7sat.noarch
* foreman-rackspace-1.11.0.76-1.el7sat.noarch
* foreman-selinux-1.11.0.4-1.el7sat.noarch
* foreman-vmware-1.11.0.76-1.el7sat.noarch
* katello-3.0.0-20.el7sat.noarch
* katello-certs-tools-2.4.0-1.el7sat.noarch
* katello-client-bootstrap-1.3.0-1.el7sat.noarch
* katello-common-3.0.0-20.el7sat.noarch
* katello-debug-3.0.0-20.el7sat.noarch
* katello-default-ca-1.0-1.noarch
* katello-installer-base-3.0.0.84-1.el7sat.noarch
* katello-selinux-3.0.1.2-1.el7sat.noarch
* katello-server-ca-1.0-1.noarch
* katello-service-3.0.0-20.el7sat.noarch
* openldap-2.4.40-13.el7.x86_64
* pulp-client-1.0-1.noarch
* pulp-docker-plugins-2.0.3.1-1.el7sat.noarch
* pulp-katello-1.0.2-1.el7sat.noarch
* pulp-ostree-plugins-1.1.3.3-1.el7sat.noarch
* pulp-puppet-plugins-2.8.7.1-1.el7sat.noarch
* pulp-puppet-tools-2.8.7.1-1.el7sat.noarch
* pulp-rpm-plugins-2.8.7.13-1.el7sat.noarch
* pulp-selinux-2.8.7.11-1.el7sat.noarch
* pulp-server-2.8.7.11-1.el7sat.noarch
* python-ldap-2.4.15-2.el7.x86_64
* tfm-rubygem-ldap_fluff-0.4.5-1.el7sat.noarch
* tfm-rubygem-net-ldap-0.13.0-1.el7sat.noarch


How reproducible:
Always


Steps to Reproduce:
1. Setup an external capsule
2. create an org and add it to the capsule with default loc
2. Create an org life cycle environment and add it to capsule
3. Create a content view with puppet module, docker repo and yum repo
4. publish the content view and promote to the created  lifecycle environment
5. launch the cmd:
hammer capsule content synchronize --id="capsule-id" --organization-id="org-id"


Actual results:
2017-05-29 17:18:49 - robottelo.ssh - INFO - <<< stderr
[ERROR 2017-05-29 10:18:49 Exception] undefined method `download_policy' for nil:NilClass
Could not synchronize capsule content:
  undefined method `download_policy' for nil:NilClass
[ERROR 2017-05-29 10:18:49 Exception] 

RestClient::InternalServerError (500 Internal Server Error):
    /opt/theforeman/tfm/root/usr/share/gems/gems/rest-client-1.6.7/lib/restclient/abstract_response.rb:48:in `return!'
    /opt/theforeman/tfm/root/usr/share/gems/gems/apipie-bindings-0.0.16/lib/apipie_bindings/api.rb:308:in `block in rest_client_call_block'
    /opt/theforeman/tfm/root/usr/share/gems/gems/rest-client-1.6.7/lib/restclient/request.rb:228:in `call'
    /opt/theforeman/tfm/root/usr/share/gems/gems/rest-client-1.6.7/lib/restclient/request.rb:228:in `process_result'
    /opt/theforeman/tfm/root/usr/share/gems/gems/rest-client-1.6.7/lib/restclient/request.rb:178:in `block in transmit'
    /opt/rh/rh-ruby22/root/usr/share/ruby/net/http.rb:853:in `start'
    /opt/theforeman/tfm/root/usr/share/gems/gems/rest-client-1.6.7/lib/restclient/request.rb:172:in `transmit'
    /opt/theforeman/tfm/root/usr/share/gems/gems/rest-client-1.6.7/lib/restclient/request.rb:64:in `execute'
    /opt/theforeman/tfm/root/usr/share/gems/gems/rest-client-1.6.7/lib/restclient/request.rb:33:in `execute'
    /opt/theforeman/tfm/root/usr/share/gems/gems/rest-client-1.6.7/lib/restclient/resource.rb:67:in `post'
    /opt/theforeman/tfm/root/usr/share/gems/gems/apipie-bindings-0.0.16/lib/apipie_bindings/api.rb:295:in `call_client'
    /opt/theforeman/tfm/root/usr/share/gems/gems/apipie-bindings-0.0.16/lib/apipie_bindings/api.rb:224:in `http_call'
    /opt/theforeman/tfm/root/usr/share/gems/gems/apipie-bindings-0.0.16/lib/apipie_bindings/api.rb:174:in `call_action'
    /opt/theforeman/tfm/root/usr/share/gems/gems/apipie-bindings-0.0.16/lib/apipie_bindings/api.rb:169:in `call'
    /opt/theforeman/tfm/root/usr/share/gems/gems/apipie-bindings-0.0.16/lib/apipie_bindings/resource.rb:14:in `call'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.5.1.13/lib/hammer_cli/apipie/command.rb:43:in `send_request'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_foreman-0.5.1.10/lib/hammer_cli_foreman/commands.rb:190:in `send_request'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_foreman_tasks-0.0.10.3/lib/hammer_cli_foreman_tasks/async_command.rb:14:in `execute'
    /opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.0.0/lib/clamp/command.rb:68:in `run'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.5.1.13/lib/hammer_cli/abstract.rb:24:in `run'
    /opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.0.0/lib/clamp/subcommand/execution.rb:11:in `execute'
    /opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.0.0/lib/clamp/command.rb:68:in `run'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.5.1.13/lib/hammer_cli/abstract.rb:24:in `run'
    /opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.0.0/lib/clamp/subcommand/execution.rb:11:in `execute'
    /opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.0.0/lib/clamp/command.rb:68:in `run'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.5.1.13/lib/hammer_cli/abstract.rb:24:in `run'
    /opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.0.0/lib/clamp/subcommand/execution.rb:11:in `execute'
    /opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.0.0/lib/clamp/command.rb:68:in `run'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.5.1.13/lib/hammer_cli/abstract.rb:24:in `run'
    /opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.0.0/lib/clamp/command.rb:133:in `run'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.5.1.13/bin/hammer:125:in `<top (required)>'
    /usr/bin/hammer:23:in `load'
    /usr/bin/hammer:23:in `<main>'



Expected results:
Sync successfully synchronized 


Additional info:
related bug https://bugzilla.redhat.com/show_bug.cgi?id=1456446

Comment 7 jcallaha 2017-06-09 22:37:19 UTC
Verified in Satellite 6.2.10 Snap 4

Followed the reported steps. See attached screenshot for content view contents.
All yum repos were sync'd on_demand

-bash-4.2# hammer capsule content synchronize --id 2 --organization-id 1
[Foreman] Password for admin: 
[...............................................................] [100%]

Comment 8 jcallaha 2017-06-09 22:37:38 UTC
Created attachment 1286556 [details]
verification screenshot

Comment 10 errata-xmlrpc 2017-06-20 17:24:24 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2017:1553