Red Hat Satellite engineering is moving the tracking of its product development work on Satellite to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "Satellite project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs will be migrated starting at the end of May. If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "Satellite project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/SAT-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1871016 - managercli.py:1364 - Error: Unable to retrieve service levels: HTTP error (404 - Not Found)
Summary: managercli.py:1364 - Error: Unable to retrieve service levels: HTTP error (40...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Hosts - Content
Version: 6.8.0
Hardware: Unspecified
OS: Unspecified
unspecified
high
Target Milestone: 6.8.0
Assignee: Jonathon Turel
QA Contact: Stephen Wadeley
URL:
Whiteboard:
Depends On:
Blocks: 1886737
TreeView+ depends on / blocked
 
Reported: 2020-08-21 06:38 UTC by qianzhan
Modified: 2020-10-27 13:08 UTC (History)
5 users (show)

Fixed In Version: tfm-rubygem-katello-3.16.0.4-1
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 1886737 (view as bug list)
Environment:
Last Closed: 2020-10-27 13:05:30 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Foreman Issue Tracker 30749 0 Normal Closed Add /owners/:id/system_purpose to RHSM Proxies Controller 2020-12-15 04:20:08 UTC
Red Hat Product Errata RHSA-2020:4366 0 None None None 2020-10-27 13:08:45 UTC

Description qianzhan 2020-08-21 06:38:31 UTC
Description of problem:
managercli.py:1364 - Error: Unable to retrieve service levels: HTTP error (404 - Not Found)

Version-Release number of selected component (if applicable):
subscription-manager-1.27.15-1.el8.x86_64
dnf-plugin-subscription-manager-1.27.15-1.el8.x86_64
python3-subscription-manager-rhsm-1.27.15-1.el8.x86_64
subscription-manager-rhsm-certificates-1.27.15-1.el8.x86_64
tfm-rubygem-katello-3.16.0-0.16.rc5.1.el7sat.noarch
katello-3.16.0-0.4.rc4.el7sat.noarch
candlepin-3.1.16-1.el7sat.noarch

How reproducible:
always

Steps to Reproduce:
This issue happens when I try to reproduce another bug:
1. On RHEL-8.3.0-20200811.0 system, update subscription-manager version from subscription-manager-1.27.13-1.el8.x86_64 to subscription-manager-1.27.15-1.el8.

2. Register RHEL-8.3.0-20200811.0 against Satellite6.8.0-snap-11.0:
[root@ibm-x3650m4-01-vm-02 ~]# subscription-manager  register
Registering to: ent-01-vm-02.lab.eng.nay.redhat.com:443/rhsm
Username: admin
Password: 
The system has been registered with ID: 07de19de-a1e7-46de-a1a9-55b995de31d0
The registered system name is: ibm-x3650m4-01-vm-02.ibm2.lab.eng.bos.redhat.com
[root@ibm-x3650m4-01-vm-02 ~]# subscription-manager  service-level --show
Service level preference not set
[root@ibm-x3650m4-01-vm-02 ~]# syspurpose show
{}

3. Set service level by subscription-manager:
[root@ibm-x3650m4-01-vm-02 ~]# subscription-manager  service-level --set=Self-Support
[root@ibm-x3650m4-01-vm-02 ~]# echo $?
70
[root@ibm-x3650m4-01-vm-02 ~]# syspurpose show
{}
[root@ibm-x3650m4-01-vm-02 ~]# subscription-manager  service-level --show
Service level preference not set
[root@ibm-x3650m4-01-vm-02 ~]# subscription-manager  service-level --set=Self-Support


4. Check rhsm.log:
[root@ibm-x3650m4-01-vm-02 ~]# tail -f /var/log/rhsm/rhsm.log 
    writer.save(ostree_config)
  File "/usr/lib64/python3.6/site-packages/subscription_manager/plugin/ostree/model.py", line 317, in save
    self.repo_file.save()
  File "/usr/lib64/python3.6/site-packages/subscription_manager/plugin/ostree/config.py", line 135, in save
    self.config_parser.save()
  File "/usr/lib64/python3.6/site-packages/subscription_manager/plugin/ostree/config.py", line 121, in save
    super(KeyFileConfigParser, self).save()
  File "/usr/lib64/python3.6/site-packages/rhsm/config.py", line 138, in save
    mode = os.stat(self.config_file).st_mode
FileNotFoundError: [Errno 2] No such file or directory: '/etc/ostree/remotes.d/redhat.conf'
2020-08-21 02:18:31,694 [INFO] subscription-manager:198769:MainThread @managerlib.py:72 - Consumer created: ibm-x3650m4-01-vm-02.ibm2.lab.eng.bos.redhat.com (07de19de-a1e7-46de-a1a9-55b995de31d0)
2020-08-21 02:18:37,512 [INFO] subscription-manager:198769:MainThread @entcertlib.py:131 - certs updated:
Total updates: 0
Found (local) serial# []
Expected (UEP) serial# []
Added (new)
  <NONE>
Deleted (rogue):
  <NONE>
2020-08-21 02:19:45,685 [WARNING] subscription-manager:198892:MainThread @cache.py:901 - Unable to get data for <class 'subscription_manager.cache.SyspurposeValidFieldsCache'> using REST API: HTTP error (404 - Not Found): 
2020-08-21 02:19:45,685 [ERROR] subscription-manager:198892:MainThread @managercli.py:1363 - HTTP error (404 - Not Found): 
Traceback (most recent call last):
  File "/usr/lib64/python3.6/site-packages/subscription_manager/managercli.py", line 1351, in _do_command
    self.set()
  File "/usr/lib64/python3.6/site-packages/subscription_manager/managercli.py", line 1372, in set
    super(ServiceLevelCommand, self).set()
  File "/usr/lib64/python3.6/site-packages/subscription_manager/managercli.py", line 746, in set
    self._is_provided_value_valid(self.options.set)
  File "/usr/lib64/python3.6/site-packages/subscription_manager/managercli.py", line 711, in _is_provided_value_valid
    valid_fields = self._get_valid_fields()
  File "/usr/lib64/python3.6/site-packages/subscription_manager/managercli.py", line 681, in _get_valid_fields
    valid_fields = get_syspurpose_valid_fields(uep=self.cp, identity=self.identity)
  File "/usr/lib64/python3.6/site-packages/subscription_manager/syspurposelib.py", line 161, in get_syspurpose_valid_fields
    syspurpose_valid_fields = cache.read_data(uep, identity)
  File "/usr/lib64/python3.6/site-packages/subscription_manager/cache.py", line 905, in read_data
    raise rest_err
  File "/usr/lib64/python3.6/site-packages/subscription_manager/cache.py", line 899, in read_data
    current_data = self._sync_with_server(uep=uep, consumer_uuid=identity.uuid)
  File "/usr/lib64/python3.6/site-packages/subscription_manager/cache.py", line 929, in _sync_with_server
    data = uep.getOwnerSyspurposeValidFields(owner['key'])
  File "/usr/lib64/python3.6/site-packages/rhsm/connection.py", line 1264, in getOwnerSyspurposeValidFields
    return self.conn.request_get(method)
  File "/usr/lib64/python3.6/site-packages/rhsm/connection.py", line 880, in request_get
    return self._request("GET", method, headers=headers, cert_key_pairs=cert_key_pairs)
  File "/usr/lib64/python3.6/site-packages/rhsm/connection.py", line 906, in _request
    info=info, headers=headers, cert_key_pairs=cert_key_pairs)
  File "/usr/lib64/python3.6/site-packages/rhsm/connection.py", line 765, in _request
    self.validateResponse(result, request_type, handler)
  File "/usr/lib64/python3.6/site-packages/rhsm/connection.py", line 839, in validateResponse
    raise RestlibException(response['status'], error_msg, response.get('headers'))
rhsm.connection.RestlibException: HTTP error (404 - Not Found): 
2020-08-21 02:19:45,689 [ERROR] subscription-manager:198892:MainThread @managercli.py:1364 - Error: Unable to retrieve service levels: HTTP error (404 - Not Found): 


Actual results:
As step 3, subscription-manager can not set service level.
As step 4, an error happens when trying to set service level: "Unable to retrieve service levels: HTTP error (404 - Not Found)"

Expected results:
Service level should be set by subscription-manager successfully, and there should not be any error in rhsm.log

Additional info:

Comment 2 qianzhan 2020-08-26 08:52:06 UTC
This bug also exists on RHEL-8.3.0-20200825.0 against Satellite6.8.0-snap-12.0

Comment 3 William Poteat 2020-08-26 16:07:09 UTC
It would appear that Satellite 6.8 whitelist does not inlcude the endpoint:

/owners/%s/system_purpose

Comment 4 Jonathon Turel 2020-08-31 18:26:20 UTC
Created redmine issue https://projects.theforeman.org/issues/30749 from this bug

Comment 5 Bryan Kearney 2020-09-01 20:04:34 UTC
Moving this bug to POST for triage into Satellite since the upstream issue https://projects.theforeman.org/issues/30749 has been resolved.

Comment 7 qianzhan 2020-09-11 03:43:29 UTC
Fixed In Version: tfm-rubygem-katello-3.16.0.4-1, and the available Satellite-6.8.0-snap-14.0 has tfm-rubygem-katello-3.16.0.3-1.el7sat.noarch. So will verify this bug when next new Satellite-6.8.0 is available.

Comment 8 qianzhan 2020-09-11 04:56:06 UTC
Version-Release number of selected component (if applicable):
subscription-manager-1.27.15-1.el8.x86_64
tfm-rubygem-katello-3.16.0.7-1.el7sat.noarch


1. Register RHEL-8.3.0-20200909.1 against Satellite6.8.0-snap-15.0:

[root@kvm-08-guest12 ~]# subscription-manager  register
Registering to: ent-01-vm-01.lab.eng.nay.redhat.com:443/rhsm
Username: admin
Password: 
The system has been registered with ID: f4949929-f9f8-4d1c-82bb-82fb8f263ba6
The registered system name is: kvm-08-guest12.hv2.lab.eng.bos.redhat.com

2. Set service level by subscription-manager:

[root@kvm-08-guest12 ~]# subscription-manager  service-level --show
Service level preference not set
[root@kvm-08-guest12 ~]# syspurpose show
{}
[root@kvm-08-guest12 ~]# subscription-manager  service-level --set=Self-Support
service_level_agreement set to "Self-Support".
[root@kvm-08-guest12 ~]# echo $?
0
[root@kvm-08-guest12 ~]# syspurpose show
{
  "service_level_agreement": "Self-Support"
}
[root@kvm-08-guest12 ~]# subscription-manager  service-level --show
Current service level: Self-Support
[root@kvm-08-guest12 ~]# 


Move this bug to VERIFIED.

Comment 11 errata-xmlrpc 2020-10-27 13:05:30 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 (Important: Satellite 6.8 release), 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/RHSA-2020:4366

Comment 12 errata-xmlrpc 2020-10-27 13:08:43 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 (Important: Satellite 6.8 release), 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/RHSA-2020:4366


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