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 1164233

Summary: Provide better error string when attempting to synchronize internal capsule
Product: Red Hat Satellite Reporter: Pavel Moravec <pmoravec>
Component: HammerAssignee: Brad Buckingham <bbuckingham>
Status: CLOSED ERRATA QA Contact: Kedar Bidarkar <kbidarka>
Severity: medium Docs Contact:
Priority: low    
Version: 6.0.4CC: bbuckingham, bkearney, ehelms, kbidarka, sghai, sthirugn, tcarlin
Target Milestone: UnspecifiedKeywords: Triaged
Target Release: Unused   
Hardware: All   
OS: All   
Whiteboard:
Fixed In Version: rubygem-hammer_cli_katello-0.0.22.10-1 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-07-27 11:13:25 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 Pavel Moravec 2014-11-14 12:05:17 UTC
Description of problem:
Trying to synchronize (internal) capsule, command:

hammer capsule content synchronize --id 1

fails. Despite id 1 works fine for other "hammer capsule" subcommands:

[root@pmoravec-rhel7-sat6 ~]# hammer  -u admin -p <password> capsule list
---|-------------------------------------------|-------------------------------------------------------
ID | NAME                                      | URL                                                   
---|-------------------------------------------|-------------------------------------------------------
1  | pmoravec-rhel7-sat6.example.com | https://pmoravec-rhel7-sat6.example.com:9090
---|-------------------------------------------|-------------------------------------------------------
[root@pmoravec-rhel7-sat6 ~]# hammer  -u admin -p <password> capsule info --id 1
Id:         1
Name:       pmoravec-rhel7-sat6.example.com
URL:        https://pmoravec-rhel7-sat6.example.com:9090
Features:   Puppet, Puppet CA, Pulp
Created at: 2014/11/12 11:36:26
Updated at: 2014/11/12 11:36:26

[root@pmoravec-rhel7-sat6 ~]# 


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


How reproducible:
100%

Steps to Reproduce:
1. Even on freshly installed Sat6, check capsule with id 1 exists (and is the internal one, usually):
hammer  -u admin -p <password> capsule info --id 1

2. Try to sync this capsule:
hammer  -u admin -p <password> capsule content synchronize --id 1


Actual results:
2. fails with:
Could not synchronize capsule content:
  Couldn't find SmartProxy with id=1 [WHERE "features"."name" IN ('Pulp Node')]


Expected results:
2. to successfully sync the capsule.


Additional info:
If _internal_ capsule within Sat6 server can't be synchronized this way, then please update installation manual having explicit command:

"# hammer capsule content synchronize --id 1 --environment-id 1"

(just before Section 5.5)

Comment 1 Pavel Moravec 2014-11-14 12:08:18 UTC
Btw expected workaround in using --name instead of --id does _not_ work:

# hammer  -u admin -p <password> capsule content synchronize --name pmoravec-sat6.example.com
Could not synchronize capsule content:
  Error: undefined method `[]' for nil:NilClass
#

Comment 2 RHEL Program Management 2014-11-14 12:13:44 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 Pavel Moravec 2014-11-14 12:28:59 UTC
Running hammer in debug mode, it apparently makes proper REST API method:

[ INFO 2014-11-14 13:13:54 API] POST /katello/api/capsules/1/content/sync
[DEBUG 2014-11-14 13:13:54 API] Params: {}
[DEBUG 2014-11-14 13:13:54 API] Headers: {}
[ERROR 2014-11-14 13:13:54 API] 404 Resource Not Found

That corresponds to API guide, Section "12.5. Synchronize Content to Capsule".

Comment 5 Pavel Moravec 2014-11-14 13:19:32 UTC
After discussing with akrzos, this is "almost" expected behaviour. Capsule sync can be done only for _external_ capsules while id 1 has the internal one (that can by synced via "hammer repository synchronize" command).

But the error when invoking:

POST /katello/api/capsules/1/content/sync

is confusing, as capsule with id 1 exists.

Please provide some better error string in this case.

Comment 8 Pavel Moravec 2016-03-14 10:50:09 UTC
*** Bug 1296843 has been marked as a duplicate of this bug. ***

Comment 9 Brad Buckingham 2016-04-28 17:29:57 UTC
As mentioned in comment 5, performing a 'capsule content synchronize' is not supported for the 'default'/'internal' capsule that is part of the Satellite server.

It looks like a better error is being displayed to the user with Satellite 6.2 Beta Snap 9:

hammer> capsule content synchronize --id 1
Could not synchronize capsule content:
  This request may only be performed on a Capsule that has the Pulp Node feature.

however, there is still an issue with the support for --name:

hammer> capsule content synchronize --name sat-test-rhel7.example.com
Could not synchronize capsule content:
  Error: undefined method `[]' for nil:NilClass

For this BZ, I will address the second the above nil:NilClass error.

Comment 10 Brad Buckingham 2016-04-28 17:38:10 UTC
Upstream hammer-cli-katello PR:

https://github.com/Katello/hammer-cli-katello/pull/389

Comment 11 Bryan Kearney 2016-04-28 18:05:15 UTC
Upstream bug component is Hammer

Comment 12 Kedar Bidarkar 2016-05-24 11:43:01 UTC
~]# hammer -u admin -p changeme capsule content synchronize --environment DEV --name abc.redhat.com --organization "Default Organization"Could not synchronize capsule content:
  This request may only be performed on a Capsule that has the Pulp Node feature.

hammer -u admin -p changeme capsule content synchronize --id 1
Could not synchronize capsule content:
  This request may only be performed on a Capsule that has the Pulp Node feature.


VERIFIED with sat62-snap12.1

Comment 13 Bryan Kearney 2016-07-27 11:13:25 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-2016:1501