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 1597075

Summary: [RFE] have 'hammer content-view version list' output a list of all versions in an environment.
Product: Red Hat Satellite Reporter: Paul Armstrong <parmstro>
Component: Content ViewsAssignee: satellite6-bugs <satellite6-bugs>
Status: CLOSED WONTFIX QA Contact: Lai <ltran>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 6.3.2CC: parmstro
Target Milestone: UnspecifiedKeywords: FutureFeature
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-11-04 14:03:26 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:
Attachments:
Description Flags
Output from tests none

Description Paul Armstrong 2018-07-02 01:41:42 UTC
Description of problem: executing hammer content-view version info returns an error indicating that there is more than one version in and environment, hammer content-view list with --environment only lists the current / active version. Would like a switch --all that lists allows hammer to list all the content views in an environment and indicate the active environment. For automation.  


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


How reproducible:
Always

Steps to Reproduce:
1. run the above commands on any content view (see below)
2.
3.

Actual results:

[root@sat6 parmstro]# hammer content-view version info --environment=Library --content-view=SOE_RHEL --organization=RedHatCanada
Error: found more than one content_view_version
[root@sat6 parmstro]# hammer content-view version list --environment=Library --content-view=SOE_RHEL --organization=RedHatCanada
----|---------------|---------|-----------------------
ID  | NAME          | VERSION | LIFECYCLE ENVIRONMENTS
----|---------------|---------|-----------------------
425 | SOE_RHEL 29.0 | 29.0    | Library               
----|---------------|---------|-----------------------
[root@sat6 parmstro]# hammer content-view version list --all --environment=Library --content-view=SOE_RHEL --organization=RedHatCanada
Error: Unrecognised option '--all'

See: 'hammer content-view version list --help'


Expected results:

[root@sat6 parmstro]# hammer content-view version list --all --environment=Library --content-view=SOE_RHEL --organization=RedHatCanada

----|---------------|---------|-----------------------
ID  | NAME          | VERSION | LIFECYCLE ENVIRONMENTS
----|---------------|---------|-----------------------
425 | SOE_RHEL 29.0 | 29.0    | Library               
411 | SOE_RHEL 28.0 | 28.0    |                       
409 | SOE_RHEL 27.0 | 27.0    |                       
398 | SOE_RHEL 26.0 | 26.0    |                       


Additional info:

Have this capability through the API and through an ansible object/module as well.

Comment 1 Brad Buckingham 2018-07-05 21:07:15 UTC
I believe the error may in the initial command:

[root@sat6 parmstro]# hammer content-view version info --environment=Library --content-view=SOE_RHEL --organization=RedHatCanada
Error: found more than one content_view_version


The reason being there can only be 1 version in an environment, so the combination of env/cv should have only identified a single version (id:425).


For example, the output below would be incorrect because versions 411, 409 & 398 are all 'archived' versions that are not associated any environment.

[root@sat6 parmstro]# hammer content-view version list --all --environment=Library --content-view=SOE_RHEL --organization=RedHatCanada

----|---------------|---------|-----------------------
ID  | NAME          | VERSION | LIFECYCLE ENVIRONMENTS
----|---------------|---------|-----------------------
425 | SOE_RHEL 29.0 | 29.0    | Library               
411 | SOE_RHEL 28.0 | 28.0    |                       
409 | SOE_RHEL 27.0 | 27.0    |                       
398 | SOE_RHEL 26.0 | 26.0    |            


Is the request that you really want to see 'archived' versions?  (i.e. those that do not have an environment)

Comment 2 Paul Armstrong 2018-07-06 14:05:42 UTC
OK.

So, am I required to specify the ID of the content view in this instance where I have multiple views ? Or should the command return me the info on the active version from the Library? 

AND very sorry my complete output is below... there are active, published CV versions that are older than the ones archived from Library...



----|---------------|---------|-----------------------
ID  | NAME          | VERSION | LIFECYCLE ENVIRONMENTS
----|---------------|---------|-----------------------
425 | SOE_RHEL 29.0 | 29.0    | Library               
411 | SOE_RHEL 28.0 | 28.0    |                       
409 | SOE_RHEL 27.0 | 27.0    |                       
398 | SOE_RHEL 26.0 | 26.0    |            
382 | SOE_RHEL 24.0 | 24.0    | Development           
380 | SOE_RHEL 23.0 | 23.0    |                       
378 | SOE_RHEL 22.0 | 22.0    |                       
----|---------------|---------|-----------------------

Now interestingly, when I use --content-view-id=425, I get the same error!

[root@sat6 parmstro]# hammer content-view version info --environment=Library --content-view-id=425 --organization=RedHatCanada
Error: found more than one content_view_version
But takes a long time to come back...
Something fishy here...

Comment 3 Paul Armstrong 2018-07-06 14:08:12 UTC
I have gone through a number of content views with similar results. 

Look at this example:

[root@sat6 parmstro]# hammer content-view version list --content-view=SOE_CPGPC --organization=RedHatCanada
----|----------------|---------|-----------------------
ID  | NAME           | VERSION | LIFECYCLE ENVIRONMENTS
----|----------------|---------|-----------------------
432 | SOE_CPGPC 45.0 | 45.0    | Library, Development  
383 | SOE_CPGPC 42.0 | 42.0    | QA                    
----|----------------|---------|-----------------------
[root@sat6 parmstro]# hammer content-view version info --environment=Library --content-view=SOE_CPGPC --organization=RedHatCanada
Error: found more than one content_view_version
[root@sat6 parmstro]# hammer content-view version info --environment=Development --content-view=SOE_CPGPC --organization=RedHatCanada
Error: found more than one content_view_version
[root@sat6 parmstro]# hammer content-view version info --environment=QA --content-view=SOE_CPGPC --organization=RedHatCanada
Error: found more than one content_view_version
[root@sat6 parmstro]# hammer content-view version promote --id 432 --organization=RedHatCanada --to-lifecycle-environment=QA
[.....................................................................................................................................................] [100%]
[root@sat6 parmstro]# hammer content-view version list --content-view=SOE_CPGPC --organization=RedHatCanada
----|----------------|---------|-------------------------
ID  | NAME           | VERSION | LIFECYCLE ENVIRONMENTS  
----|----------------|---------|-------------------------
432 | SOE_CPGPC 45.0 | 45.0    | Library, Development, QA
383 | SOE_CPGPC 42.0 | 42.0    |                         
----|----------------|---------|-------------------------
[root@sat6 parmstro]# hammer content-view version info --environment=Library --content-view=SOE_CPGPC --organization=RedHatCanada
Error: found more than one content_view_version
[root@sat6 parmstro]# hammer content-view version delete --id=383 --organization=RedHatCanada --content-view=SOE_CPGPC
[.....................................................................................................................................................] [100%]
[root@sat6 parmstro]# hammer content-view version list --content-view=SOE_CPGPC --organization=RedHatCanada
----|----------------|---------|-------------------------
ID  | NAME           | VERSION | LIFECYCLE ENVIRONMENTS  
----|----------------|---------|-------------------------
432 | SOE_CPGPC 45.0 | 45.0    | Library, Development, QA
----|----------------|---------|-------------------------
[root@sat6 parmstro]# hammer content-view version info --environment=Library --content-view=SOE_CPGPC --organization=RedHatCanada
ID:                     432
Name:                   SOE_CPGPC 45.0
Version:                45.0
Description:            
Content View ID:        10
Content View Name:      SOE_CPGPC
Content View Label:     SOE_CPGPC
Lifecycle Environments: 
 1) ID:    6
    Name:  Library
    Label: Library
 2) ID:    7
    Name:  Development
    Label: Development
 3) ID:    8
    Name:  QA
    Label: QA
Repositories:           
 1) ID:    4997
    Name:  Red Hat Satellite Tools 6.3 for RHEL 7 Server RPMs x86_64
    Label: Red_Hat_Satellite_Tools_6_3_for_RHEL_7_Server_RPMs_x86_64
 2) ID:    4998
    Name:  Red Hat Satellite Tools 6.3 - Puppet 4 for RHEL 7 Server RPMs x86_64
    Label: Red_Hat_Satellite_Tools_6_3_-_Puppet_4_for_RHEL_7_Server_RPMs_x86_64
 3) ID:    4999
    Name:  Red Hat Ansible Engine 2.5 RPMs for Red Hat Enterprise Linux 7 Server x86_64
    Label: Red_Hat_Ansible_Engine_2_5_RPMs_for_Red_Hat_Enterprise_Linux_7_Server_x86_64
 4) ID:    5000
    Name:  Red Hat Enterprise Linux High Availability for RHEL 7 Server RPMs x86_64 7Server
    Label: Red_Hat_Enterprise_Linux_High_Availability_for_RHEL_7_Server_RPMs_x86_64_7Server
 5) ID:    5001
    Name:  Red Hat Enterprise Linux Resilient Storage for RHEL 7 Server RPMs x86_64 7Server
    Label: Red_Hat_Enterprise_Linux_Resilient_Storage_for_RHEL_7_Server_RPMs_x86_64_7Server
 6) ID:    5002
    Name:  Red Hat Software Collections RPMs for Red Hat Enterprise Linux 7 Server x86_64 7Server
    Label: Red_Hat_Software_Collections_RPMs_for_Red_Hat_Enterprise_Linux_7_Server_x86_64_7Server
 7) ID:    5003
    Name:  Red Hat Virt V2V Tool for RHEL 7 RPMs x86_64 7Server
    Label: Red_Hat_Virt_V2V_Tool_for_RHEL_7_RPMs_x86_64_7Server
 8) ID:    5004
    Name:  Red Hat Storage Native Client for RHEL 7 RPMs x86_64 7Server
    Label: Red_Hat_Storage_Native_Client_for_RHEL_7_RPMs_x86_64_7Server
 9) ID:    5005
    Name:  Red Hat Enterprise Linux 7 Server - Supplementary RPMs x86_64 7Server
    Label: Red_Hat_Enterprise_Linux_7_Server_-_Supplementary_RPMs_x86_64_7Server
 10)ID:    5006
    Name:  Red Hat Enterprise Linux 7 Server RPMs x86_64 7Server
    Label: Red_Hat_Enterprise_Linux_7_Server_RPMs_x86_64_7Server
 11)ID:    5007
    Name:  Red Hat Enterprise Linux 7 Server - RH Common RPMs x86_64 7Server
    Label: Red_Hat_Enterprise_Linux_7_Server_-_RH_Common_RPMs_x86_64_7Server
 12)ID:    5008
    Name:  Red Hat Enterprise Linux 7 Server - Optional RPMs x86_64 7Server
    Label: Red_Hat_Enterprise_Linux_7_Server_-_Optional_RPMs_x86_64_7Server
 13)ID:    5009
    Name:  Red Hat Enterprise Linux 7 Server - Extras RPMs x86_64
    Label: Red_Hat_Enterprise_Linux_7_Server_-_Extras_RPMs_x86_64
Puppet Modules:         
 1) ID:      4623
    Name:    cpgpc
    Author:  parmstro
    Version: 0.2.0
 2) ID:      5603
    Name:    ntp
    Author:  dhoppe
    Version: 1.3.1
 3) ID:      7277
    Name:    concat
    Author:  puppetlabs
    Version: 4.0.0
 4) ID:      8142
    Name:    foreman_scap_client
    Author:  theforeman
    Version: 0.3.18
 5) ID:      10337
    Name:    stdlib
    Author:  puppetlabs
    Version: 4.25.1
[root@sat6 parmstro]#

Comment 4 Paul Armstrong 2018-07-06 14:11:48 UTC
My SOE_RHEL is at the base of all my Content Views. I am going to promote the most recent, promote all my Composite Content Views, clean up and delete all archived content views and reset this scenario on this system. And then retest, and provide results. 

Stay tuned.

Comment 5 Paul Armstrong 2018-07-06 17:36:16 UTC
Please see the output of my latest tests.
Attached: screen.log

Cleaned all content views to ensure that there were no extraneous content views or apparent data corruption. 

Even though I specify the content view name, the environment and the organization AND it is the only content view in the environment. The following command returns "Found more than 1 content view." 

info level details require the content view version id
other hammer commands filter on values similar to the above without issue.

either the command needs to:
- filter properly and return the matching content view info
- OR needs to indicate that id is a required parameter
- OR needs to return info for the 'Active' cv in the environment

Right now the return is not making any sense. Or Maybe I am missing something.

Comment 6 Paul Armstrong 2018-07-06 17:36:58 UTC
Created attachment 1457056 [details]
Output from tests

Comment 7 Bryan Kearney 2019-11-04 14:03:26 UTC
Thank you for your interest in Satellite 6. We have evaluated this request, and while we recognize that it is a valid request, we do not expect this to be implemented in the product in the foreseeable future. This is due to other priorities for the product, and not a reflection on the request itself. We are therefore closing this out as WONTFIX. If you have any concerns about this, please do not reopen. Instead, feel free to contact Red Hat Technical Support. Thank you.