Bug 1223038

Summary: RepoActionInvoker.is_managed() broken in subscription-manager-1.14.5-1.el6.x86_64 /usr/share/rhsm/subscription_manager/repolib.py
Product: Red Hat Enterprise Linux 6 Reporter: John W. Lamb <jolamb>
Component: subscription-managerAssignee: Adrian Likins <alikins>
Status: CLOSED ERRATA QA Contact: John Sefler <jsefler>
Severity: urgent Docs Contact:
Priority: unspecified    
Version: 6.7CC: alikins, jolamb, tlavigne, wpoteat
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-07-22 06:54:10 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: 1125249, 1221024    
Attachments:
Description Flags
Script to demonstrate bug in repolib RepoActionInvoker.is_managed() class method none

Description John W. Lamb 2015-05-19 16:23:13 UTC
Description of problem:

Calling RepoActionInvoker.is_managed() on a RHEL 6.7 beta installation yields an exception:

  File "/usr/share/rhsm/subscription_manager/repolib.py", line 58, in is_managed
    return repo in [c.label for c in action.matching_content()]
AttributeError: 'RepoUpdateActionCommand' object has no attribute 'matching_content'


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

subscription-manager-1.14.5-1.el6.x86_64

How reproducible:

Easily

Steps to Reproduce:
1. Copy the attached script to /tmp/ismanagedtest.py on a RHEL 6.7 system
2. Run "python /tmp/ismanagedtest.py"
3. Observe the traceback with the aforementioned exception

Actual results:

Traceback (most recent call last):
  File "/tmp/ismanagedtest.py", line 14, in <module>
    print rai.is_managed('some_repo')
  File "/usr/share/rhsm/subscription_manager/repolib.py", line 58, in is_managed
    return repo in [c.label for c in action.matching_content()]
AttributeError: 'RepoUpdateActionCommand' object has no attribute 'matching_content'

Expected results:

False

(The test script should output the return value of `rai.is_managed('some_repo')`, which should be False)

Additional info:

OpenShift Enterprise 2.x depends on this method call working as expected.

Comment 1 John W. Lamb 2015-05-19 16:23:40 UTC
Created attachment 1027300 [details]
Script to demonstrate bug in repolib RepoActionInvoker.is_managed() class method

Comment 3 Adrian Likins 2015-05-19 17:00:18 UTC
This should be something we can fix for 6.7 with minimal impact
on subman (it doesn't use that code directly anywhere).

Comment 5 Adrian Likins 2015-05-26 16:16:12 UTC
pr for review at https://github.com/candlepin/subscription-manager/pull/1192

Comment 7 William Poteat 2015-06-02 14:14:23 UTC
master commit 729f1972487be3397fbbc94f2867e5cc16f6e8f5

Comment 9 John Sefler 2015-06-06 13:22:13 UTC
Verifying Version...
[root@jsefler-os6 ~]# rpm -q subscription-manager
subscription-manager-1.14.9-1.el6.x86_64

[root@jsefler-os6 ~]# wget https://bugzilla.redhat.com/attachment.cgi?id=1027300 -q -O /tmp/ismanagedtest.py
[root@jsefler-os6 ~]# cat /tmp/ismanagedtest.py
import sys

_LIBPATH = "/usr/share/rhsm"
# add to the path if need be
if _LIBPATH not in sys.path:
    sys.path.append(_LIBPATH)

from subscription_manager.injectioninit import init_dep_injection
init_dep_injection()
from subscription_manager.repolib import RepoActionInvoker
rai = RepoActionInvoker()

# Should print "False" if is_managed is working
print rai.is_managed('some_repo')

[root@jsefler-os6 ~]# python /tmp/ismanagedtest.py
False


VERIFIED: The test script returned False as desired.

Comment 10 errata-xmlrpc 2015-07-22 06:54:10 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-1345.html