Bug 1164233 - Provide better error string when attempting to synchronize internal capsule
Summary: Provide better error string when attempting to synchronize internal capsule
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Hammer
Version: 6.0.4
Hardware: All
OS: All
low
medium
Target Milestone: Unspecified
Assignee: Brad Buckingham
QA Contact: Kedar Bidarkar
URL:
Whiteboard:
: 1296843 (view as bug list)
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-11-14 12:05 UTC by Pavel Moravec
Modified: 2020-03-11 14:52 UTC (History)
7 users (show)

Fixed In Version: rubygem-hammer_cli_katello-0.0.22.10-1
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-07-27 11:13:25 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Foreman Issue Tracker 14871 0 Normal Closed hammer-cli-katello: 'capsule content synchronize' generates error with 'name' input 2020-06-17 16:11:05 UTC
Red Hat Bugzilla 1102485 0 unspecified CLOSED capsule: Unhandled error when passing bad id to 'hammer capsule content' 2021-02-22 00:41:40 UTC
Red Hat Bugzilla 1164251 0 medium CLOSED capsule content synchronize: invalid example 2021-02-22 00:41:40 UTC
Red Hat Knowledge Base (Solution) 1269323 0 None None None Never

Internal Links: 1102485 1164251

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


Note You need to log in before you can comment on or make changes to this bug.