Bug 1331739

Summary: subscription-manager repo-override --remove= (with an empty string) --repo=<id> behaves like --remove-all
Product: Red Hat Enterprise Linux 7 Reporter: Rehana <redakkan>
Component: subscription-managerAssignee: Kevin Howell <khowell>
Status: CLOSED ERRATA QA Contact: John Sefler <jsefler>
Severity: medium Docs Contact:
Priority: low    
Version: 7.3CC: csnyder, khowell, redakkan, vrjain
Target Milestone: rcKeywords: EasyFix, Triaged
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-08-01 19:18:42 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 Rehana 2016-04-29 12:22:22 UTC
Description of problem:


Version-Release number of selected component (if applicable):
server type: Red Hat Subscription Management
subscription management server: 0.9.51.15-1
subscription management rules: 5.15.1
subscription-manager: 1.17.5-1.el7
python-rhsm: 1.17.2-1.el7


How reproducible:
3/3

Steps to Reproduce:
1.REgister and attach subscription
2.Add a repo-override in the system
3.Now try to remove the override without giving the override name 
ex: 
# subscription-manager repo-override --remove --repo=rhel-7-server-rhceph-1.3-tools-debug-rpms
Error: You must specify a repository to modify


Actual results:
Observed "Error: You must specify a repository to modify" message is displayed

Expected results:
Message should be ex" "Error: You must specify a name of the override to remove" message is displayed

Additional info:

Comment 3 John Sefler 2016-06-06 14:34:52 UTC
In my opinion this is not a bug, but a misinterpreted python argument

As written in the problem description comment 0, the "--repo=rhel-7-server-rhceph-1.3-tools-debug-rpms" is being interpreted as the value for the --remove option.  If you re-arrange the arguments you will get the expected results...


[root@jsefler-rhel7 ~]# subscription-manager repo-override --remove --repo=rhel-7-server-rhceph-1.3-tools-debug-rpms
Error: You must specify a repository to modify
[root@jsefler-rhel7 ~]# 

^^ That is a repeat of comment 0 where "--repo=rhel-7-server-rhceph-1.3-tools-debug-rpms" is being interpreted as the value for --remove


Now let's just change the order of the arguments...

[root@jsefler-rhel7 ~]# subscription-manager repo-override --repo=rhel-7-server-rhceph-1.3-tools-debug-rpms --remove
Usage: subscription-manager repo-override [OPTIONS]

subscription-manager: error: --remove option requires an argument
[root@jsefler-rhel7 ~]# 

VERIFIED: I would agree with the tool's response, the --remove option does indeed require an argument (the name of the override to remove).

Comment 4 Rehana 2016-06-06 15:25:30 UTC
After discussing with John , it came to our notice that the original bug is slightly different. 

Observed that "subscription-manager repo-override --remove= --repo=<repo id> " ==> removes all the repo-overrides from the specified repo like the --remove-all option

Its the same for the --remove="" options too 

Steps:
========

# subscription-manager repo-override --list
Repository: bar
  xyz: 2

Repository: foo
  abc: 1
  efg: 1


# subscription-manager repo-override --repo=foo --remove=
# subscription-manager repo-override --list
Repository: bar
  xyz: 2
^^ REMOVED OVERRIDES FROM --FOO REPO

# subscription-manager repo-override --repo=bar --remove=""
# subscription-manager repo-override --list
This system does not have any content overrides applied to it.
^^ REMOVED OVERRIDES FROM --BAR REPO ,leaving no overrides on the system


Expected results:

Appropriate error message should be displayed when no name value is specified for --remove option

ex: name: many not be null

Comment 5 John Sefler 2016-06-06 15:58:23 UTC
The reason why we are suggesting that "name: may not be null" is the expected result of subscription-manager repo-override --repo=bar --remove="" is because it complements the current behavior of --add when an empty string is passed as the name of the repo parameter

[root@jsefler-rhel7 ~]# subscription-manager repo-override --repo=bar --add="":VALUE
name: may not be null
[root@jsefler-rhel7 ~]# subscription-manager repo-override --repo=bar --add=:VALUE
name: may not be null
[root@jsefler-rhel7 ~]# subscription-manager repo-override --repo=bar --add :VALUE
name: may not be null
[root@jsefler-rhel7 ~]#

Comment 7 Rehana 2017-04-03 04:30:14 UTC
Retested on ,

subscription management server: 0.9.51.21-1
subscription management rules: 5.15.1
subscription-manager: 1.19.4-1.el7
python-rhsm: 1.19.2-1.el7


# subscription-manager repo-override --repo=rhel-7-server-rh-common-debug-rpms --remove=
Error: You must specify an override name with --remove.

# subscription-manager repo-override --repo=rhel-7-server-rh-common-debug-rpms --remove=""
Error: You must specify an override name with --remove.

# subscription-manager repo-override --remove= --repo=rhel-7-server-rh-common-debug-rpms
Error: You must specify an override name with --remove.

# subscription-manager repo-override --remove="" --repo=rhel-7-server-rh-common-debug-rpms
Error: You must specify an override name with --remove.
# subscription-manager repo-override --list
Repository: rhel-7-server-extras-rpms
  enabled:  1
  gpgcheck: 1

Repository: rhel-7-server-rh-common-debug-rpms
  enabled: 1
  new:     testing
  test:    true


Observed that now when no value is given for the option --remove ,an appropriate error message "Error: You must specify an override name with --remove." is displayed and none of the overrides were removed.

Marking as Verified!!

Comment 8 errata-xmlrpc 2017-08-01 19:18:42 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://access.redhat.com/errata/RHBA-2017:2083