Bug 1194906

Summary: rhsm-debug system --no-subscriptions --subscriptions should throw a usage error
Product: Red Hat Enterprise Linux 6 Reporter: John Sefler <jsefler>
Component: subscription-managerAssignee: candlepin-bugs
Status: CLOSED NEXTRELEASE QA Contact: John Sefler <jsefler>
Severity: low Docs Contact:
Priority: low    
Version: 6.7CC: alikins, bcourt, dgoodwin
Target Milestone: rcKeywords: Reopened, Triaged
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-10-09 17:41:01 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:
Bug Depends On:    
Bug Blocks: 1209535    

Description John Sefler 2015-02-20 22:03:03 UTC
Description of problem:
As a result of the following commit 029f786999f5b1cd1d9614976fb4544ca6541b3b...

    1114117: Stop collecting subs info by default.
    
    Add a '--subscriptions' cli option now, and make '--no-subscriptions'
    the default behaviour. For orgs with lots of subscriptions
    available, the candlepin api request getSubscriptionsList can
    be very slow.

There are now two options --no-subscriptions and --subscriptions that instruct the rhsm-debug tool to do opposite tasks.  I realize that if both are specified on the command line then the last one specified wins.  Unfortunately, this is not obvious to all users.  For usability sake, it would be better to throw an error similar to other subscription manager commands, for example:
  [root@jsefler-os6 ~]# subscription-manager repo-override --list --remove-all
  Error: You may not use --list with --remove-all
  [root@jsefler-os6 ~]# echo $?
  64


Version-Release number of selected component (if applicable):
[root@jsefler-os6 ~]# rpm -q subscription-manager
subscription-manager-1.14.1-1.git.16.8bd8008.el6.x86_64


How reproducible:


Steps to Reproduce:
[root@jsefler-os6 ~]# rhsm-debug system --no-subscriptions --subscriptions
Wrote: /tmp/rhsm-debug-system-20150220-694959.tar.gz


Actual results:
shown above
if --subscriptions is specified last, then subscriptions.json is written
if --no-subscriptions is specified last, then subscriptions.json is not written

Expected results:
[root@jsefler-os6 ~]# rhsm-debug system --no-subscriptions --subscriptions
Error: You may not use --subscriptions with --no-subscriptions
[root@jsefler-os6 ~]# echo $?
64    <====== exit code for EX_USAGE

Comment 2 RHEL Program Management 2015-02-23 20:56:27 UTC
Development Management has reviewed and declined this request.
You may appeal this decision by reopening this request.

Comment 5 John Sefler 2015-09-29 20:19:12 UTC
Note: This bug is no longer an issue now that options --no-subscriptions and --subscriptions are ignored.  See bug 1246680

This is now the expected behavior in subscription-manager-1.15.9-12 and newer...

[root@jsefler-7 ~]# rhsm-debug system --subscriptions --no-subscriptions
Wrote: /tmp/rhsm-debug-system-20150929-850365.tar.gz

[root@jsefler-7 ~]# tail -f /var/log/rhsm/rhsm.log
2015-09-29 15:58:20,957 [INFO] rhsm-debug:5008 @debug_commands.py:98 - The rhsm-debug options '--subscriptions' and '--no-subscriptions' have no effect now.


VERIFIED: The options --subscriptions and --no-subscriptions are ignored.  Otherwise the call would have failed with rhsm-debug: error: no such option: --subscriptions.  Moreover an INFO log was written to rhsm.log

Comment 6 Barnaby Court 2015-10-09 17:41:01 UTC
Since comment 5 says this is no longer an issue, closing as next release.