Red Hat Bugzilla – Bug 1223953
content-view add-repository silently fails if product is not provided
Last modified: 2016-07-27 05:15:43 EDT
Description of problem: content-view add-repository silently fails if product is not provided Version-Release number of selected component (if applicable): Sat 6.1 GA Snap 5 How reproducible: Always Steps to Reproduce: hammer> content-view add-repository --name=sat6toolscustomrepo1 --organization-id=1 --name=rhel7partialcv The repository has been associated But looking at content-view info shows that the repo is not associated: hammer> content-view info --name=rhel7partialcv --organization-id=1ID: 4 ... Yum Repositories: 1) ID: 2 Name: Red Hat Enterprise Linux 7 Server RPMs x86_64 7Server Label: Red_Hat_Enterprise_Linux_7_Server_RPMs_x86_64_7Server Docker Repositories: Puppet Modules: ... Actual results: If product option is not provided, Repo is not associated as shown above. Expected results: If product option is not provided, show an error message and not a success message. Additional info: Alternatively, passing product option makes this scenario work fine: hammer> content-view add-repository --name=sat6toolscustomrepo1 --organization-id=1 --name=rhel7partialcv --product=sat6toolscustom The repository has been associated hammer> content-view info --name=rhel7partialcv --organization-id=1ID: 4 Name: rhel7partialcv ... Yum Repositories: 1) ID: 2 Name: Red Hat Enterprise Linux 7 Server RPMs x86_64 7Server Label: Red_Hat_Enterprise_Linux_7_Server_RPMs_x86_64_7Server 2) ID: 16 Name: sat6toolscustomrepo1 Label: sat6toolscustomrepo1 ...
The behavior has changed since the bug was initially created; however, the issue raised by this bug is not fully addressed. The key issue that remains is that if user attempts executes add-repository with out any repository information (name or id), the command is successful with no error to the user. # 'add-repository' without repo info. (FAIL) hammer> content-view add-repository --name zoo2 --organization-id 3 The repository has been associated # 'add-repository' by repository name, but without product (PASS) hammer> content-view add-repository --name zoo2 --organization-id 3 --repository zoo Could not add repository: Error: Could not find product, please set one of options --product, --product-id. # 'add-repository' by repository and product name (PASS) hammer> content-view add-repository --name zoo2 --organization-id 3 --repository zoo --product zoo The repository has been associated # observe that repo was added to the content view hammer> content-view info --organization-id 3 --name zoo2 ID: 6 Name: zoo2 Label: zoo2 Composite: false Description: Content Host Count: 0 Organization: myorg Yum Repositories: 1) ID: 13 Name: zoo Label: zoo Docker Repositories: Puppet Modules: Lifecycle Environments: Versions: Components: Activation Keys: hammer>
Created redmine issue http://projects.theforeman.org/issues/14174 from this bug
Upstream Katello PR: https://github.com/Katello/hammer-cli-katello/pull/364
Upstream bug component is Content Management
hammer> content-view create --name bz1223953 --organization-id 3 Content view created hammer> content-view info --name bz1223953 --organization-id 3 ID: 8 Name: bz1223953 Label: bz1223953 Composite: false Description: Content Host Count: 0 Organization: IBM Yum Repositories: Docker Repositories: OSTree Repositories: Puppet Modules: Lifecycle Environments: Versions: Components: Activation Keys: hammer> content-view add-repository --name bz1223953 --organization-id 3 Could not add repository: Error: At least one of options --repository-id, --repository is required See: ' content-view add-repository --help' hammer> content-view add-repository --name bz1223953 --organization-id 3 --repository 'African Animals' Could not add repository: Error: Could not find product, please set one of options --product, --product-id. hammer> content-view add-repository --name bz1223953 --organization-id 3 --product 'Zoo Repo'Could not add repository: Error: At least one of options --repository-id, --repository is required See: ' content-view add-repository --help' hammer> content-view add-repository --name bz1223953 --organization-id 3 --product 'Zoo Repo' --repository 'African Animals' The repository has been associated hammer> content-view info --name bz1223953 --organization-id 3ID: 8 Name: bz1223953 Label: bz1223953 Composite: false Description: Content Host Count: 0 Organization: IBM Yum Repositories: 1) ID: 31 Name: African Animals Label: African_Animals Docker Repositories: OSTree Repositories: Puppet Modules: Lifecycle Environments: Versions: Components: Activation Keys:
Verified as per last comment on Satellite 6.2.0 SNAP 5.1
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