Bug 1035493

Summary: subscription-manager attempts to gather content overrides from servers that do not support them.
Product: Red Hat Enterprise Linux 7 Reporter: Alex Wood <awood>
Component: subscription-managerAssignee: candlepin-bugs
Status: CLOSED DUPLICATE QA Contact: John Sefler <jsefler>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 7.0   
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-12-02 14:33:29 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:

Description Alex Wood 2013-11-27 22:23:06 UTC
Description of problem:  The new repo-override command added functionality to query a server about overrides that have been applied to a repository for a consumer.  However, if a server does not support the overrides API an error will be thrown.  Currently, we are not checking if overrides are supported in the OverrideStatusCache before attempting to fetch them.

How reproducible: Always.

Steps to Reproduce:
1. Make sure your subscription-manager is the latest version.
2. Register against stage.
3. Run a repos --list

Actual results:
Remote server error. Please check the connection details, or see /var/log/rhsm/rhsm.log for more information.

2013-11-27 17:14:32,347 [DEBUG] subscription-manager @connection.py:444 - Making request: GET /subscription/consumers/7acf14b7-7cd9-4ae4-9e57-fb30691ead96/content_overrides
2013-11-27 17:14:32,615 [DEBUG] subscription-manager @connection.py:467 - Response: status=404
2013-11-27 17:14:32,616 [ERROR] subscription-manager @connection.py:496 - Response: 404
2013-11-27 17:14:32,616 [ERROR] subscription-manager @connection.py:497 - JSON parsing error: No JSON object could be decoded
2013-11-27 17:14:32,617 [ERROR] subscription-manager @managercli.py:155 - exception caught in subscription-manager
2013-11-27 17:14:32,617 [ERROR] subscription-manager @managercli.py:156 - Server error attempting a GET to /subscription/consumers/7acf14b7-7cd9-4ae4-9e57-fb30691ead96/content_overrides returned status 404
Traceback (most recent call last):
  File "bin/subscription-manager", line 82, in <module>
    sys.exit(abs(main() or 0))
  File "bin/subscription-manager", line 73, in main
    return managercli.ManagerCLI().main()
  File "/root/devel/subscription-manager/src/subscription_manager/managercli.py", line 2407, in main
    return CLI.main(self)
  File "/root/devel/subscription-manager/src/subscription_manager/cli.py", line 166, in main
    return cmd.main()
  File "/root/devel/subscription-manager/src/subscription_manager/managercli.py", line 452, in main
    return_code = self._do_command()
  File "/root/devel/subscription-manager/src/subscription_manager/managercli.py", line 1822, in _do_command
    repos = rl.get_repos()
  File "/root/devel/subscription-manager/src/subscription_manager/repolib.py", line 55, in get_repos
    action = UpdateAction(self.uep, cache_only=self.cache_only, apply_overrides=apply_overrides)
  File "/root/devel/subscription-manager/src/subscription_manager/repolib.py", line 121, in __init__
    status = override_cache.load_status(self.uep, self.identity.uuid)
  File "/root/devel/subscription-manager/src/subscription_manager/cache.py", line 211, in load_status
    self._sync_with_server(uep, uuid)
  File "/root/devel/subscription-manager/src/subscription_manager/cache.py", line 325, in _sync_with_server
    self.server_status = uep.getContentOverrides(consumer_uuid)
  File "/usr/lib64/python2.6/site-packages/rhsm/connection.py", line 1065, in getContentOverrides
    return self.conn.request_get(method)
  File "/usr/lib64/python2.6/site-packages/rhsm/connection.py", line 548, in request_get
    return self._request("GET", method)
  File "/usr/lib64/python2.6/site-packages/rhsm/connection.py", line 476, in _request
    self.validateResponse(result, request_type, handler)
  File "/usr/lib64/python2.6/site-packages/rhsm/connection.py", line 524, in validateResponse
    handler=handler)
RemoteServerException: Server error attempting a GET to /subscription/consumers/7acf14b7-7cd9-4ae4-9e57-fb30691ead96/content_overrides returned status 404
2

Expected results: No errors

Additional info:  The OverrideStatusCache probably just needs a 
"if uep.supports_resource('content_overrides')" guard around it.

Comment 2 Alex Wood 2013-12-02 14:33:29 UTC

*** This bug has been marked as a duplicate of bug 1034649 ***