Bug 1223953

Summary: content-view add-repository silently fails if product is not provided
Product: Red Hat Satellite Reporter: sthirugn <sthirugn>
Component: Content ManagementAssignee: Brad Buckingham <bbuckingham>
Status: CLOSED ERRATA QA Contact: Og Maciel <omaciel>
Severity: high Docs Contact:
Priority: unspecified    
Version: 6.1.0CC: bbuckingham, daviddavis, omaciel
Target Milestone: UnspecifiedKeywords: Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
URL: http://projects.theforeman.org/issues/14174
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-07-27 09:15:43 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 sthirugn@redhat.com 2015-05-21 18:58:35 UTC
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
...

Comment 2 Brad Buckingham 2016-03-10 21:27:22 UTC
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>

Comment 3 Brad Buckingham 2016-03-14 09:12:11 UTC
Created redmine issue http://projects.theforeman.org/issues/14174 from this bug

Comment 4 Brad Buckingham 2016-03-14 09:31:45 UTC
Upstream Katello PR: https://github.com/Katello/hammer-cli-katello/pull/364

Comment 5 Bryan Kearney 2016-03-14 10:01:35 UTC
Upstream bug component is Content Management

Comment 6 Og Maciel 2016-03-24 18:09:20 UTC
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:

Comment 7 Og Maciel 2016-03-24 18:29:19 UTC
Verified as per last comment on Satellite 6.2.0 SNAP 5.1

Comment 10 errata-xmlrpc 2016-07-27 09:15:43 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