Bug 1146125 - [RFE] would like a --contains-text option for subscription-manager list module
Summary: [RFE] would like a --contains-text option for subscription-manager list module
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: subscription-manager
Version: 7.1
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Devan Goodwin
QA Contact: John Sefler
URL:
Whiteboard:
Keywords: FutureFeature
: 1121768 (view as bug list)
Depends On:
Blocks: rhsm-rhel71
TreeView+ depends on / blocked
 
Reported: 2014-09-24 14:07 UTC by John Sefler
Modified: 2015-03-05 13:17 UTC (History)
6 users (show)

(edit)
Clone Of:
(edit)
Last Closed: 2015-03-05 13:17:58 UTC


Attachments (Terms of Use)


External Trackers
Tracker ID Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2015:0502 normal SHIPPED_LIVE subscription-manager bug fix and enhancement update 2015-03-05 16:20:39 UTC
Red Hat Bugzilla 1121768 None None None Never

Internal Trackers: 1121768

Description John Sefler 2014-09-24 14:07:30 UTC
Description of problem:
When running subscription-manager list --available, it can be tedious to scroll through a long list of available pool blocks for a subscription to a layered product that is not already installed on the system.  For example, if I know that I want to find a pool to an available subscription whose name contains the text "RAM Limiting", I currently need to creatively pipe the list results through grep.  Instead, I would prefer a simple "--contains-text" option that would list the available subscription blocks that possesses any field (name,sku,provides,contract,serviceLevel,systemType,etc..) that contains the given text string.

Note: subscription-manager-gui's All Available Subscriptions tab already has a "Contains the text" filter.  Adding a "--contains-text" option to the subscription-manager list module will provide greater parity between the GUI and CLI tools.

Note: this new "--contains-text" option should be applicable with any of the list module reports including:
  subscription-manager list --available 
  subscription-manager list --installed
  subscription-manager list --consumed

Comment 1 Devan Goodwin 2014-09-30 13:13:18 UTC
See team email exchange for other ideas on this, --match-name has been proposed for consistency with --match-installed. 

Might be better implemented on the server as well.

Comment 2 Devan Goodwin 2014-10-08 12:51:35 UTC
We're going to limit scope on this for now to just list --available, the others (--installed and --consumed) are going to go onto backlog. Ok to assume this bug is just for list --available and move it through the process as such?

The other two will require a separate and very different client side implementation.

Client should error out if you use --contains-text without --available, and if you're combining --available with --installed/--consumed it should just print a warning.

Comment 3 Devan Goodwin 2014-10-17 13:28:25 UTC
*** Bug 1121768 has been marked as a duplicate of this bug. ***

Comment 4 Devan Goodwin 2014-10-17 13:36:13 UTC
Final implementation will be --matches on the list command. It will work for installed/available/consumed, though the information searched will vary.

* and ? are supported, there is no implicit wildcard at the start and end of the search string so if you want to search for anything containing "SCL", you would use --matches "*SCL*". This allows you to search for exact matches.

list available fields searched include SKU, subscription name, contract number, engineering product names and IDs, and SLA.

Comment 5 Devan Goodwin 2014-10-24 16:52:00 UTC
Implemented in: subscription-manager-1.13.6-1

Comment 6 John Sefler 2014-10-27 22:23:15 UTC
While testing, I found that when calling subscription-manager list --available --matches with a productId will search BOTH the providedProducts AND the derivedProvidedProducts of an available subscription pool.  This is good!

Comment 7 Chris "Ceiu" Rog 2014-10-29 13:47:39 UTC
The --matches option will match a variety of fields, varying with the list type:

Installed
==============================
- Product Name
- Product ID

Available
==============================
- Subscription Name
- Product Name & Product ID for each product listed under Provides
- SKU
- Contract
- Service Level

Consumed
==============================
- Subscription Name
- Product Name & Product ID for each product listed under Provides
- SKU
- Contract
- Service Level

Comment 9 John Sefler 2014-11-12 16:58:14 UTC
WARNING:  I must add that the new subscription-manager list --available --matches will only work against a candlepin entitlement server version >= 0.9.33-1.   Against an older version, the --matches argument will effectively be ignored and your matches result will erroneously be longer than you expected.

To check the version of your candlepin entitlement server, type...

[root@jsefler-os7 ~]# subscription-manager version
server type: Red Hat Subscription Management
subscription management server: 0.9.35-1       <<<==============
subscription management rules: 5.11
subscription-manager: 1.13.8-1.el7
python-rhsm: 1.13.7-1.el7

Comment 11 Shwetha Kallesh 2014-11-26 12:44:53 UTC
Marking verified!!

[root@dhcp35-236 ~]# subscription-manager version
server type: Red Hat Subscription Management
subscription management server: 0.9.36-1
subscription management rules: 5.11
subscription-manager: 1.13.9-1.el7
python-rhsm: 1.13.8-1.el7

List --avail

a)With subscription-name

[root@dhcp35-236 ~]# subscription-manager list --avail --matches *Bundled
+-------------------------------------------+
    Available Subscriptions
+-------------------------------------------+
Subscription Name: Awesome OS Server Bundled
Provides:          Management Bits
                   Load Balancing Bits
                   Shared Storage Bits
                   Clustering Bits
                   Awesome OS Server Bits
                   Large File Support Bits
SKU:               awesomeos-server
Contract:          3
Pool ID:           8ac681e449e0b63d0149e0b7998118a0
Available:         10
Suggested:         1
Service Level:     Premium
Service Type:      Level 3
Subscription Type: Standard
Ends:              11/24/2015
System Type:       Physical

b) With SKU

[root@dhcp35-236 ~]# subscription-manager list --avail --matches *everything
+-------------------------------------------+
    Available Subscriptions
+-------------------------------------------+
Subscription Name: Awesome OS for x86_64/i686/ia64/ppc/ppc64/s390x/s390
Provides:          Awesome OS for x86_64/i686/ia64/ppc/ppc64/s390x/s390 Bits
SKU:               awesomeos-everything
Contract:          3
Pool ID:           8ac681e449e0b63d0149e0b771020e8e
Available:         10
Suggested:         1
Service Level:     
Service Type:      
Subscription Type: Standard
Ends:              11/24/2015
System Type:       Physical

c) With contract

[root@dhcp35-236 ~]# subscription-manager list --avail --matches 19*
+-------------------------------------------+
    Available Subscriptions
+-------------------------------------------+
Subscription Name: Multi-Stackable for 100000000000002
Provides:          Awesome OS for x86_64 Bits
SKU:               multi-stackable
Contract:          1974242685
Pool ID:           8ac681e449e0b63d0149e636b5a34f12
Available:         20
Suggested:         1
Service Level:     
Service Type:      
Subscription Type: Stackable
Ends:              12/10/2014
System Type:       Physical

d) With service-level

[root@dhcp35-236 ~]# subscription-manager list --avail --matches premium
+-------------------------------------------+
    Available Subscriptions
+-------------------------------------------+
Subscription Name: Multi-Attribute Stackable (4 cores)
Provides:          Multi-Attribute Limited Product
SKU:               cores4-multiattr
Contract:          3
Pool ID:           8ac681e449e0b63d0149e0b74e220848
Available:         10
Suggested:         1
Service Level:     Premium
Service Type:      Level 3
Subscription Type: Stackable
Ends:              11/24/2015
System Type:       Physical

Subscription Name: Multi-Attribute Stackable (2 GB, 2 Cores)
Provides:          Multi-Attribute Limited Product
SKU:               2cores-2ram-multiattr
Contract:          3
Pool ID:           8ac681e449e0b63d0149e0b7484c078d
Available:         10
Suggested:         4
Service Level:     Premium
Service Type:      Level 3
Subscription Type: Stackable
Ends:              11/24/2015
System Type:       Physical


e) product id
[root@dhcp35-236 ~]# subscription-manager list --avail --matches 32*
+-------------------------------------------+
    Available Subscriptions
+-------------------------------------------+
Subscription Name: Awesome OS Instance Based (Standard Support)
Provides:          Awesome OS Instance Server Bits
SKU:               awesomeos-instancebased
Contract:          2
Pool ID:           8ac681e449e0b63d0149e0b794671758
Available:         6
Suggested:         0
Service Level:     Standard
Service Type:      L1-L3
Subscription Type: Instance Based
Ends:              11/24/2015
System Type:       Physical

Subscription Name: Awesome OS Instance Based (Standard Support)
Provides:          Awesome OS Instance Server Bits
SKU:               awesomeos-instancebased
Contract:          3
Pool ID:           8ac681e449e0b63d0149e0b7910d1693
Available:         20
Suggested:         0
Service Level:     Standard
Service Type:      L1-L3
Subscription Type: Instance Based
Ends:              11/24/2015
System Type:       Physical

list --installed

a) product id

[root@dhcp35-236 ~]# subscription-manager list --installed --matches 6*

+-------------------------------------------+
    Installed Product Status
+-------------------------------------------+
Product Name:   Red Hat Enterprise Linux Server
Product ID:     69
Version:        7.1 Beta
Arch:           x86_64
Status:         Not Subscribed
Status Details: Not supported by a valid subscription.
Starts:         
Ends: 

b) product name

[root@dhcp35-236 ~]# subscription-manager list --installed --matches *Instance*

+-------------------------------------------+
    Installed Product Status
+-------------------------------------------+
Product Name:   Awesome OS Instance Server Bits
Product ID:     32060
Version:        6.1
Arch:           ALL
Status:         Not Subscribed
Status Details: Not supported by a valid subscription.
Starts:         
Ends:           

List --consumed

a) with subscription name

[root@dhcp35-236 ~]# subscription-manager list --consumed --matches *Instance*
+-------------------------------------------+
   Consumed Subscriptions
+-------------------------------------------+
Subscription Name: Awesome OS Instance Based one socket
Provides:          Awesome OS Instance Server Bits
SKU:               awesomeos-onesocketib
Contract:          3
Account:           12331131231
Serial:            1400180804162574833
Pool ID:           8ac681e449e0b63d0149e0b78ecd15e0
Active:            True
Quantity Used:     2
Service Level:     Standard
Service Type:      L1-L3
Status Details:    
Subscription Type: Instance Based
Starts:            11/24/2014
Ends:              11/24/2015
System Type:       Physical


b) Product id

[root@dhcp35-236 ~]# subscription-manager list --consumed --matches 32*
+-------------------------------------------+
   Consumed Subscriptions
+-------------------------------------------+
Subscription Name: Awesome OS Instance Based one socket
Provides:          Awesome OS Instance Server Bits
SKU:               awesomeos-onesocketib
Contract:          3
Account:           12331131231
Serial:            1400180804162574833
Pool ID:           8ac681e449e0b63d0149e0b78ecd15e0
Active:            True
Quantity Used:     2
Service Level:     Standard
Service Type:      L1-L3
Status Details:    
Subscription Type: Instance Based
Starts:            11/24/2014
Ends:              11/24/2015
System Type:       Physical

c) sku
[root@dhcp35-236 ~]# subscription-manager list --consumed --matches *onesocketib
+-------------------------------------------+
   Consumed Subscriptions
+-------------------------------------------+
Subscription Name: Awesome OS Instance Based one socket
Provides:          Awesome OS Instance Server Bits
SKU:               awesomeos-onesocketib
Contract:          3
Account:           12331131231
Serial:            1400180804162574833
Pool ID:           8ac681e449e0b63d0149e0b78ecd15e0
Active:            True
Quantity Used:     2
Service Level:     Standard
Service Type:      L1-L3
Status Details:    
Subscription Type: Instance Based
Starts:            11/24/2014
Ends:              11/24/2015
System Type:       Physical

d) contract

[root@dhcp35-236 ~]# subscription-manager list --consumed --matches 39*
+-------------------------------------------+
   Consumed Subscriptions
+-------------------------------------------+
Subscription Name: virt-only-product to be added to activation key
Provides:          
SKU:               virt-only-test-product
Contract:          397660012
Account:           475158165
Serial:            8871526791561291295
Pool ID:           8ac681e449e0b63d0149e6cd56415dcc
Active:            True
Quantity Used:     1
Service Level:     
Service Type:      
Status Details:    
Subscription Type: Standard
Starts:            11/24/2014
Ends:              12/10/2014
System Type:       Physical

e) Service level

[root@dhcp35-236 ~]# subscription-manager list --consumed --matches standard
+-------------------------------------------+
   Consumed Subscriptions
+-------------------------------------------+
Subscription Name: Awesome OS Instance Based one socket
Provides:          Awesome OS Instance Server Bits
SKU:               awesomeos-onesocketib
Contract:          3
Account:           12331131231
Serial:            1400180804162574833
Pool ID:           8ac681e449e0b63d0149e0b78ecd15e0
Active:            True
Quantity Used:     2
Service Level:     Standard
Service Type:      L1-L3
Status Details:    
Subscription Type: Instance Based
Starts:            11/24/2014
Ends:              11/24/2015
System Type:       Physical

Comment 13 errata-xmlrpc 2015-03-05 13:17:58 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://rhn.redhat.com/errata/RHBA-2015-0502.html


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