Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.
Bug 1597075 - [RFE] have 'hammer content-view version list' output a list of all versions in an environment.
Summary: [RFE] have 'hammer content-view version list' output a list of all versions i...
Keywords:
Status: NEW
Alias: None
Product: Red Hat Satellite 6
Classification: Red Hat
Component: Content Views
Version: 6.3.2
Hardware: Unspecified
OS: Unspecified
unspecified
medium vote
Target Milestone: Unspecified
Assignee: satellite6-bugs
QA Contact: Lai
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2018-07-02 01:41 UTC by Paul Armstrong
Modified: 2019-03-30 03:41 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed:
Target Upstream Version:


Attachments (Terms of Use)
Output from tests (deleted)
2018-07-06 17:36 UTC, Paul Armstrong
no flags Details

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


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