Bug 1254977

Summary: hammer content-view create doesn't accept repositories names
Product: Red Hat Satellite Reporter: Lukas Pramuk <lpramuk>
Component: HammerAssignee: Katello Bug Bin <katello-bugs>
Status: CLOSED DUPLICATE QA Contact: Lukas Pramuk <lpramuk>
Severity: high Docs Contact:
Priority: high    
Version: 6.1.0CC: andrew.schofield, avaddara, bbuckingham, kabbott, sclayton, vdhande
Target Milestone: Unspecified   
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-04-18 14:00:19 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 Lukas Pramuk 2015-08-19 11:23:39 UTC
Description of problem:
hammer content-view create doesn't accept repositories names
Using --repositories option you are unable to create CV.
But using --repository-ids option it works.

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

How reproducible:
100%

Steps to Reproduce:
0.Setup vars:
# product="Red Hat Enterprise Linux Server"
# reposet="Red Hat Enterprise Linux 7 Server (RPMs)"
# reponame="Red Hat Enterprise Linux 7 Server RPMs x86_64 7Server"

1.Enable repository:
# hammer repository-set enable --organization-id 1 --product "$product" --name "$reposet" --releasever 7Server --basearch x86_64
Repository enabled

2.Create CV
# hammer content-view create --organization-id 1 --name CV --repositories "$reponame"
Could not create the content view:
  Error: Could not find repository, please set one of options --repositories, --repository-ids.

But using --repository-ids option it works:
# repoid=$(hammer --csv repository info --organization-id 1 --product "$product" --name "$reponame" | awk -F, 'NR>1{print $1}')
# echo $repoid
71
# hammer content-view create --organization-id 1 --name CV_ids --repository-ids "$repoid"
Content view created


Actual results:
Error: Could not create the content view

Expected results:
CV is created even with using --repositories

Additional info:
possibly it would require to introduce new option '--product' to uniquely specify repository by its name

Comment 1 Lukas Pramuk 2015-08-19 11:28:17 UTC
there is a related bug #1228890, but it is for creating CV filter
(hammer content-view filter create ...)

Comment 4 Stephen Clayton 2015-10-29 17:09:08 UTC
This also does not work with hammer content-view update ...

Comment 5 Brad Buckingham 2015-11-18 20:17:33 UTC
*** Bug 1255560 has been marked as a duplicate of this bug. ***

Comment 7 Brad Buckingham 2016-04-18 14:00:19 UTC
This bug has been solved by bug 1213097 and is being delivered in Satellite 6.2; therefore, going to close this one as a duplicate.

E.g. output with the above fix:

hammer> content-view create --organization-id 1 --name cli-cv --product zoo --repositories zoo
Content view created

hammer> content-view info --organization-id 1 --name cli-cv
ID:                     15
Name:                   cli-cv
Label:                  cli-cv
Composite:              false
Description:            
Content Host Count:     0
Organization:           Default Organization
Yum Repositories:       
 1) ID:    40
    Name:  zoo
    Label: zoo
Docker Repositories:    

OSTree Repositories:    

Puppet Modules:         

Lifecycle Environments: 

Versions:               

Components:             

Activation Keys:

hammer>

*** This bug has been marked as a duplicate of bug 1213097 ***