RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 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 "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". 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 "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-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 1916540 - Negative proxy tests occasionally encounter the wrong exception handling
Summary: Negative proxy tests occasionally encounter the wrong exception handling
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 8
Classification: Red Hat
Component: subscription-manager
Version: 8.4
Hardware: Unspecified
OS: Unspecified
unspecified
low
Target Milestone: rc
: 8.5
Assignee: candlepin-bugs
QA Contact: Red Hat subscription-manager QE Team
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2021-01-15 02:04 UTC by John Sefler
Modified: 2021-11-10 07:51 UTC (History)
2 users (show)

Fixed In Version: subscription-manager-1.28.16-1.el8
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2021-11-09 19:37:35 UTC
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github candlepin subscription-manager pull 2509 0 None closed 1916540: Negative proxy tests occasionally encounter the wrong except… 2021-04-23 08:02:10 UTC
Github candlepin subscription-manager pull 2602 0 None closed 1916540: Negative proxy tests occasionally encounter the wrong except… 2021-04-23 08:02:11 UTC
Red Hat Product Errata RHBA-2021:4390 0 None None None 2021-11-09 19:37:50 UTC

Description John Sefler 2021-01-15 02:04:29 UTC
Description of problem:

We have a series of automated negative proxy tests that are trying to assert that "Proxy error, unable to connect to proxy server." is presented to the user, but instead, "Error updating system data on the server, see /var/log/rhsm/rhsm.log for more details." is presented.  Reviewing the rhsm.log reveals a stack of four nested exceptions that are caught and raised.  This seems excessive and reports a slightly misleading exception.

Here is a simple two-line fix that can be added to subscription_manager/cache.py
@@ -180,6 +180,8 @@ class CacheManager(object):
                 return 1
             except connection.RestlibException as re:
                 raise re
+            except connection.ProxyException as pe:
+                raise pe
             except Exception as e:
                 log.error("Error updating system data on the server")
                 log.exception(e)


Version-Release number of selected component (if applicable):
[root@kvm-08-guest18 ~]# rpm -q subscription-manager
subscription-manager-1.28.9-1.el8.x86_64


How reproducible:


Steps to Reproduce:
[root@kvm-08-guest18 ~]# subscription-manager register --username=stage_auto_testuser --serverurl=subscription.rhsm.stage.redhat.com:443/subscription
Password: 
Registering to: subscription.rhsm.stage.redhat.com:443/subscription
The system has been registered with ID: 1ea30b80-ea53-4949-8a02-429a9f983c1b
The registered system name is: kvm-08-guest18.hv2.lab.eng.bos.redhat.com
[root@kvm-08-guest18 ~]# 
[root@kvm-08-guest18 ~]# subscription-manager config --server.proxy_hostname=bad-proxy --server.proxy_port=3129
[root@kvm-08-guest18 ~]# 
[root@kvm-08-guest18 ~]# subscription-manager list --available
Proxy error, unable to connect to proxy server.
[root@kvm-08-guest18 ~]# 
[root@kvm-08-guest18 ~]# echo '{"foo":"bar"}' > /etc/rhsm/facts/custom.facts
[root@kvm-08-guest18 ~]# 
[root@kvm-08-guest18 ~]# subscription-manager list --available
Error updating system data on the server, see /var/log/rhsm/rhsm.log for more details.
[root@kvm-08-guest18 ~]# 
[root@kvm-08-guest18 ~]# tail -109 /var/log/rhsm/rhsm.log
2021-01-14 20:40:37,189 [DEBUG] subscription-manager:409955:MainThread @cache.py:172 - Checking current system info against cache: /var/lib/rhsm/facts/facts.json
2021-01-14 20:40:37,216 [DEBUG] subscription-manager:409955:MainThread @dmiinfo.py:76 - Using dmidecode dump file: /dev/mem
2021-01-14 20:40:37,267 [DEBUG] subscription-manager:409955:MainThread @custom.py:87 - Loading custom facts from: /etc/rhsm/facts/custom.facts
2021-01-14 20:40:37,268 [DEBUG] subscription-manager:409955:MainThread @cache.py:174 - System data has changed, updating server.
2021-01-14 20:40:37,268 [DEBUG] subscription-manager:409955:MainThread @facts.py:87 - Updating facts on server
2021-01-14 20:40:37,268 [DEBUG] subscription-manager:409955:MainThread @connection.py:700 - Making request: PUT /subscription/consumers/1ea30b80-ea53-4949-8a02-429a9f983c1b
2021-01-14 20:40:37,270 [DEBUG] subscription-manager:409955:MainThread @connection.py:558 - Loaded CA certificates from /etc/rhsm/ca/: redhat-entitlement-authority.pem, redhat-uep.pem
2021-01-14 20:40:37,270 [DEBUG] subscription-manager:409955:MainThread @connection.py:587 - Using proxy: bad-proxy:3129
2021-01-14 20:40:37,292 [ERROR] subscription-manager:409955:MainThread @cache.py:184 - Error updating system data on the server
2021-01-14 20:40:37,292 [ERROR] subscription-manager:409955:MainThread @cache.py:185 - Unable to connect to: bad-proxy:3129 [Errno -2] Name or service not known 
Traceback (most recent call last):
  File "/usr/lib64/python3.6/site-packages/rhsm/connection.py", line 719, in _request
    conn.request(request_type, handler, body=body, headers=final_headers)
  File "/usr/lib64/python3.6/http/client.py", line 1269, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "/usr/lib64/python3.6/http/client.py", line 1315, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "/usr/lib64/python3.6/http/client.py", line 1264, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/usr/lib64/python3.6/http/client.py", line 1040, in _send_output
    self.send(msg)
  File "/usr/lib64/python3.6/http/client.py", line 978, in send
    self.connect()
  File "/usr/lib64/python3.6/http/client.py", line 1429, in connect
    super().connect()
  File "/usr/lib64/python3.6/http/client.py", line 950, in connect
    (self.host,self.port), self.timeout, self.source_address)
  File "/usr/lib64/python3.6/socket.py", line 704, in create_connection
    for res in getaddrinfo(host, port, 0, SOCK_STREAM):
  File "/usr/lib64/python3.6/socket.py", line 745, in getaddrinfo
    for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno -2] Name or service not known

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib64/python3.6/site-packages/subscription_manager/cache.py", line 176, in update_check
    self._sync_with_server(uep, consumer_uuid)
  File "/usr/lib64/python3.6/site-packages/subscription_manager/facts.py", line 88, in _sync_with_server
    uep.updateConsumer(consumer_uuid, facts=self.get_facts())
  File "/usr/lib64/python3.6/site-packages/rhsm/connection.py", line 1182, in updateConsumer
    ret = self.conn.request_put(method, params)
  File "/usr/lib64/python3.6/site-packages/rhsm/connection.py", line 906, in request_put
    return self._request("PUT", method, params, headers=headers)
  File "/usr/lib64/python3.6/site-packages/rhsm/connection.py", line 923, in _request
    info=info, headers=headers, cert_key_pairs=cert_key_pairs)
  File "/usr/lib64/python3.6/site-packages/rhsm/connection.py", line 749, in _request
    err))
rhsm.connection.ProxyException: Unable to connect to: bad-proxy:3129 [Errno -2] Name or service not known 
2021-01-14 20:40:37,293 [ERROR] subscription-manager:409955:MainThread @managercli.py:218 - exception caught in subscription-manager
2021-01-14 20:40:37,293 [ERROR] subscription-manager:409955:MainThread @managercli.py:219 - Error updating system data on the server, see /var/log/rhsm/rhsm.log for more details.
Traceback (most recent call last):
  File "/usr/lib64/python3.6/site-packages/rhsm/connection.py", line 719, in _request
    conn.request(request_type, handler, body=body, headers=final_headers)
  File "/usr/lib64/python3.6/http/client.py", line 1269, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "/usr/lib64/python3.6/http/client.py", line 1315, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "/usr/lib64/python3.6/http/client.py", line 1264, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/usr/lib64/python3.6/http/client.py", line 1040, in _send_output
    self.send(msg)
  File "/usr/lib64/python3.6/http/client.py", line 978, in send
    self.connect()
  File "/usr/lib64/python3.6/http/client.py", line 1429, in connect
    super().connect()
  File "/usr/lib64/python3.6/http/client.py", line 950, in connect
    (self.host,self.port), self.timeout, self.source_address)
  File "/usr/lib64/python3.6/socket.py", line 704, in create_connection
    for res in getaddrinfo(host, port, 0, SOCK_STREAM):
  File "/usr/lib64/python3.6/socket.py", line 745, in getaddrinfo
    for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno -2] Name or service not known

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib64/python3.6/site-packages/subscription_manager/cache.py", line 176, in update_check
    self._sync_with_server(uep, consumer_uuid)
  File "/usr/lib64/python3.6/site-packages/subscription_manager/facts.py", line 88, in _sync_with_server
    uep.updateConsumer(consumer_uuid, facts=self.get_facts())
  File "/usr/lib64/python3.6/site-packages/rhsm/connection.py", line 1182, in updateConsumer
    ret = self.conn.request_put(method, params)
  File "/usr/lib64/python3.6/site-packages/rhsm/connection.py", line 906, in request_put
    return self._request("PUT", method, params, headers=headers)
  File "/usr/lib64/python3.6/site-packages/rhsm/connection.py", line 923, in _request
    info=info, headers=headers, cert_key_pairs=cert_key_pairs)
  File "/usr/lib64/python3.6/site-packages/rhsm/connection.py", line 749, in _request
    err))
rhsm.connection.ProxyException: Unable to connect to: bad-proxy:3129 [Errno -2] Name or service not known 

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib64/python3.6/site-packages/subscription_manager/managercli.py", line 546, in main
    return_code = self._do_command()
  File "/usr/lib64/python3.6/site-packages/subscription_manager/managercli.py", line 2953, in _do_command
    after_date=after_date,
  File "/usr/lib64/python3.6/site-packages/rhsmlib/services/entitlement.py", line 394, in get_available_pools
    items_per_page=_items_per_page
  File "/usr/lib64/python3.6/site-packages/subscription_manager/managerlib.py", line 344, in get_available_entitlements
    items_per_page=items_per_page
  File "/usr/lib64/python3.6/site-packages/subscription_manager/managerlib.py", line 563, in get_filtered_pools_list
    items_per_page=items_per_page
  File "/usr/lib64/python3.6/site-packages/subscription_manager/managerlib.py", line 279, in list_pools
    require(FACTS).update_check(uep, consumer_uuid)
  File "/usr/lib64/python3.6/site-packages/subscription_manager/cache.py", line 186, in update_check
    raise Exception(_("Error updating system data on the server, see /var/log/rhsm/rhsm.log "
Exception: Error updating system data on the server, see /var/log/rhsm/rhsm.log for more details.
[root@kvm-08-guest18 ~]# 


Actual results:
Error updating system data on the server, see /var/log/rhsm/rhsm.log for more details.


Expected results:
Proxy error, unable to connect to proxy server.



Additional info:

Comment 1 Archana Pandey 2021-04-22 14:11:43 UTC
Pre-verifying on subscription-manager-1.28.15-1.el8.x86_64

verification steps:
[root@hpe-dl380pgen8-02-vm-3 ~]# subscription-manager version
server type: Red Hat Subscription Management
subscription management server: Unknown
subscription management rules: Unknown
subscription-manager: 1.28.15-1.el8
[root@hpe-dl380pgen8-02-vm-3 ~]# 
[root@hpe-dl380pgen8-02-vm-3 ~]# rpm -qa --changelog subscription-manager | grep 1916540
[root@hpe-dl380pgen8-02-vm-3 ~]#                                                 <<<<<<< rpm changelog not present for fix


[root@hpe-dl380pgen8-02-vm-3 ~]# subscription-manager register --username archana-486 --password redhat
Registering to: subscription.rhsm.stage.redhat.com:443/subscription
The system has been registered with ID: 88a65fd8-809e-4d84-9260-a8026167da39
The registered system name is: hpe-dl380pgen8-02-vm-3.hpe2.lab.eng.bos.redhat.com
[root@hpe-dl380pgen8-02-vm-3 ~]# 
[root@hpe-dl380pgen8-02-vm-3 ~]# 
[root@hpe-dl380pgen8-02-vm-3 ~]# 
[root@hpe-dl380pgen8-02-vm-3 ~]# subscription-manager config --server.proxy_hostname=bad-proxy --server.proxy_port=3129

[root@hpe-dl380pgen8-02-vm-3 ~]# subscription-manager list --available
Proxy error, unable to connect to proxy server.

[root@hpe-dl380pgen8-02-vm-3 ~]# echo '{"foo":"bar"}' > /etc/rhsm/facts/custom.facts
[root@hpe-dl380pgen8-02-vm-3 ~]# subscription-manager list --available
Error updating system data on the server, see /var/log/rhsm/rhsm.log for more details.   <<<< exception message not fixed


Additional info: rhsm.log

2021-04-22 10:06:26,043 [ERROR] subscription-manager:106305:MainThread @cache.py:184 - Error updating system data on the server
2021-04-22 10:06:26,043 [ERROR] subscription-manager:106305:MainThread @cache.py:185 - Unable to connect to: bad-proxy:3129 [Errno -2] Name or service not known 
Traceback (most recent call last):
  File "/usr/lib64/python3.6/site-packages/rhsm/connection.py", line 728, in _request
    conn.request(request_type, handler, body=body, headers=final_headers)
  File "/usr/lib64/python3.6/http/client.py", line 1269, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "/usr/lib64/python3.6/http/client.py", line 1315, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "/usr/lib64/python3.6/http/client.py", line 1264, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/usr/lib64/python3.6/http/client.py", line 1040, in _send_output
    self.send(msg)
  File "/usr/lib64/python3.6/http/client.py", line 978, in send
    self.connect()
  File "/usr/lib64/python3.6/http/client.py", line 1429, in connect
    super().connect()
  File "/usr/lib64/python3.6/http/client.py", line 950, in connect
    (self.host,self.port), self.timeout, self.source_address)
  File "/usr/lib64/python3.6/socket.py", line 704, in create_connection
    for res in getaddrinfo(host, port, 0, SOCK_STREAM):
  File "/usr/lib64/python3.6/socket.py", line 745, in getaddrinfo
    for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno -2] Name or service not known

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib64/python3.6/site-packages/subscription_manager/cache.py", line 176, in update_check
    self._sync_with_server(uep, consumer_uuid)
  File "/usr/lib64/python3.6/site-packages/subscription_manager/facts.py", line 88, in _sync_with_server
    uep.updateConsumer(consumer_uuid, facts=self.get_facts())
  File "/usr/lib64/python3.6/site-packages/rhsm/connection.py", line 1224, in updateConsumer
    ret = self.conn.request_put(method, params)
  File "/usr/lib64/python3.6/site-packages/rhsm/connection.py", line 915, in request_put
    return self._request("PUT", method, params, headers=headers)
  File "/usr/lib64/python3.6/site-packages/rhsm/connection.py", line 932, in _request
    info=info, headers=headers, cert_key_pairs=cert_key_pairs)
  File "/usr/lib64/python3.6/site-packages/rhsm/connection.py", line 758, in _request
    err))
rhsm.connection.ProxyException: Unable to connect to: bad-proxy:3129 [Errno -2] Name or service not known 
2021-04-22 10:06:26,045 [ERROR] subscription-manager:106305:MainThread @managercli.py:218 - exception caught in subscription-manager
2021-04-22 10:06:26,045 [ERROR] subscription-manager:106305:MainThread @managercli.py:219 - Error updating system data on the server, see /var/log/rhsm/rhsm.log for more details.
Traceback (most recent call last):
  File "/usr/lib64/python3.6/site-packages/rhsm/connection.py", line 728, in _request
    conn.request(request_type, handler, body=body, headers=final_headers)
  File "/usr/lib64/python3.6/http/client.py", line 1269, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "/usr/lib64/python3.6/http/client.py", line 1315, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "/usr/lib64/python3.6/http/client.py", line 1264, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/usr/lib64/python3.6/http/client.py", line 1040, in _send_output
    self.send(msg)
  File "/usr/lib64/python3.6/http/client.py", line 978, in send
    self.connect()
  File "/usr/lib64/python3.6/http/client.py", line 1429, in connect
    super().connect()
  File "/usr/lib64/python3.6/http/client.py", line 950, in connect
    (self.host,self.port), self.timeout, self.source_address)
  File "/usr/lib64/python3.6/socket.py", line 704, in create_connection
    for res in getaddrinfo(host, port, 0, SOCK_STREAM):
  File "/usr/lib64/python3.6/socket.py", line 745, in getaddrinfo
    for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno -2] Name or service not known

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib64/python3.6/site-packages/subscription_manager/cache.py", line 176, in update_check
    self._sync_with_server(uep, consumer_uuid)
  File "/usr/lib64/python3.6/site-packages/subscription_manager/facts.py", line 88, in _sync_with_server
    uep.updateConsumer(consumer_uuid, facts=self.get_facts())
  File "/usr/lib64/python3.6/site-packages/rhsm/connection.py", line 1224, in updateConsumer
    ret = self.conn.request_put(method, params)
  File "/usr/lib64/python3.6/site-packages/rhsm/connection.py", line 915, in request_put
    return self._request("PUT", method, params, headers=headers)
  File "/usr/lib64/python3.6/site-packages/rhsm/connection.py", line 932, in _request
    info=info, headers=headers, cert_key_pairs=cert_key_pairs)
  File "/usr/lib64/python3.6/site-packages/rhsm/connection.py", line 758, in _request
    err))
rhsm.connection.ProxyException: Unable to connect to: bad-proxy:3129 [Errno -2] Name or service not known 

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib64/python3.6/site-packages/subscription_manager/managercli.py", line 546, in main
    return_code = self._do_command()
  File "/usr/lib64/python3.6/site-packages/subscription_manager/managercli.py", line 2953, in _do_command
    after_date=after_date,
  File "/usr/lib64/python3.6/site-packages/rhsmlib/services/entitlement.py", line 394, in get_available_pools
    items_per_page=_items_per_page
  File "/usr/lib64/python3.6/site-packages/subscription_manager/managerlib.py", line 344, in get_available_entitlements
    items_per_page=items_per_page
  File "/usr/lib64/python3.6/site-packages/subscription_manager/managerlib.py", line 563, in get_filtered_pools_list
    items_per_page=items_per_page
  File "/usr/lib64/python3.6/site-packages/subscription_manager/managerlib.py", line 279, in list_pools
    require(FACTS).update_check(uep, consumer_uuid)
  File "/usr/lib64/python3.6/site-packages/subscription_manager/cache.py", line 186, in update_check
    raise Exception(_("Error updating system data on the server, see /var/log/rhsm/rhsm.log "
Exception: Error updating system data on the server, see /var/log/rhsm/rhsm.log for more details.
[root@hpe-dl380pgen8-02-vm-3 ~]# 


based on above observations, issue is not fixed in subscription-manager-1.28.15-1.el8.x86_64
setting verified: FailedQA

Comment 2 Tiffany Merry 2021-04-22 15:54:47 UTC
PR https://github.com/candlepin/subscription-manager/pull/2602 is for subscription-manager-1.28

Comment 3 Archana Pandey 2021-04-28 08:42:16 UTC
Verifying bug on : subscription-manager-1.28.16-1.el8.x86_64

Steps for verification:

[root@hpe-dl380pgen8-02-vm-8 ~]# subscription-manager version
server type: This system is currently not registered.
subscription management server: 3.2.16-1
subscription management rules: 5.41
subscription-manager: 1.28.16-1.el8
[root@hpe-dl380pgen8-02-vm-8 ~]# 
[root@hpe-dl380pgen8-02-vm-8 ~]# rpm -qa --changelog subscription-manager | grep 1916540
- 1916540: Negative proxy tests occasionally encounter the wrong exception

[root@hpe-dl380pgen8-02-vm-8 ~]# subscription-manager register --username ****** --password *********
Registering to: subscription.rhsm.stage.redhat.com:443/subscription
The system has been registered with ID: 99aa9fe7-b94e-4734-9df5-d9d37bf9c9ee
The registered system name is: hpe-dl380pgen8-02-vm-8.hpe2.lab.eng.bos.redhat.com
[root@hpe-dl380pgen8-02-vm-8 ~]# 
[root@hpe-dl380pgen8-02-vm-8 ~]# subscription-manager config --server.proxy_hostname=bad-proxy --server.proxy_port=3129
[root@hpe-dl380pgen8-02-vm-8 ~]# 
[root@hpe-dl380pgen8-02-vm-8 ~]# subscription-manager list --available
Proxy error, unable to connect to proxy server.
[root@hpe-dl380pgen8-02-vm-8 ~]# 
[root@hpe-dl380pgen8-02-vm-8 ~]# echo '{"foo":"bar"}' > /etc/rhsm/facts/custom.facts
[root@hpe-dl380pgen8-02-vm-8 ~]# subscription-manager list --available
Proxy error, unable to connect to proxy server. <<< Expected exception message appeared



snippet from rhsm.log :

[root@hpe-dl380pgen8-02-vm-8 ~]# tail -110  /var/log/rhsm/rhsm.log 
2021-04-28 04:27:37,497 [ERROR] subscription-manager:52017:MainThread @managercli.py:218 - exception caught in subscription-manager
2021-04-28 04:27:37,497 [ERROR] subscription-manager:52017:MainThread @managercli.py:219 - Unable to connect to: bad-proxy:3129 [Errno -2] Name or service not known 
Traceback (most recent call last):
  File "/usr/lib64/python3.6/site-packages/rhsm/connection.py", line 728, in _request
    conn.request(request_type, handler, body=body, headers=final_headers)
  File "/usr/lib64/python3.6/http/client.py", line 1269, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "/usr/lib64/python3.6/http/client.py", line 1315, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "/usr/lib64/python3.6/http/client.py", line 1264, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/usr/lib64/python3.6/http/client.py", line 1040, in _send_output
    self.send(msg)
  File "/usr/lib64/python3.6/http/client.py", line 978, in send
    self.connect()
  File "/usr/lib64/python3.6/http/client.py", line 1429, in connect
    super().connect()
  File "/usr/lib64/python3.6/http/client.py", line 950, in connect
    (self.host,self.port), self.timeout, self.source_address)
  File "/usr/lib64/python3.6/socket.py", line 704, in create_connection
    for res in getaddrinfo(host, port, 0, SOCK_STREAM):
  File "/usr/lib64/python3.6/socket.py", line 745, in getaddrinfo
    for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno -2] Name or service not known

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib64/python3.6/site-packages/subscription_manager/managercli.py", line 564, in main
    return_code = self._do_command()
  File "/usr/lib64/python3.6/site-packages/subscription_manager/managercli.py", line 3001, in _do_command
    after_date=after_date,
  File "/usr/lib64/python3.6/site-packages/rhsmlib/services/entitlement.py", line 403, in get_available_pools
    iso_dates=iso_dates
  File "/usr/lib64/python3.6/site-packages/subscription_manager/managerlib.py", line 345, in get_available_entitlements
    items_per_page=items_per_page
  File "/usr/lib64/python3.6/site-packages/subscription_manager/managerlib.py", line 569, in get_filtered_pools_list
    items_per_page=items_per_page
  File "/usr/lib64/python3.6/site-packages/subscription_manager/managerlib.py", line 282, in list_pools
    profile_mgr.update_check(uep, consumer_uuid)
  File "/usr/lib64/python3.6/site-packages/subscription_manager/cache.py", line 472, in update_check
    supported_resources = get_supported_resources()
  File "/usr/lib64/python3.6/site-packages/subscription_manager/utils.py", line 250, in get_supported_resources
    return uep.get_supported_resources()
  File "/usr/lib64/python3.6/site-packages/rhsm/connection.py", line 990, in get_supported_resources
    self._load_supported_resources()
  File "/usr/lib64/python3.6/site-packages/rhsm/connection.py", line 978, in _load_supported_resources
    resources_list = self.conn.request_get("/")
  File "/usr/lib64/python3.6/site-packages/rhsm/connection.py", line 906, 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 932, in _request
    info=info, headers=headers, cert_key_pairs=cert_key_pairs)
  File "/usr/lib64/python3.6/site-packages/rhsm/connection.py", line 758, in _request
    err))
rhsm.connection.ProxyException: Unable to connect to: bad-proxy:3129 [Errno -2] Name or service not known 
2021-04-28 04:27:52,583 [ERROR] subscription-manager:52070:MainThread @managercli.py:218 - exception caught in subscription-manager
2021-04-28 04:27:52,583 [ERROR] subscription-manager:52070:MainThread @managercli.py:219 - Unable to connect to: bad-proxy:3129 [Errno -2] Name or service not known 
Traceback (most recent call last):
  File "/usr/lib64/python3.6/site-packages/rhsm/connection.py", line 728, in _request
    conn.request(request_type, handler, body=body, headers=final_headers)
  File "/usr/lib64/python3.6/http/client.py", line 1269, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "/usr/lib64/python3.6/http/client.py", line 1315, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "/usr/lib64/python3.6/http/client.py", line 1264, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/usr/lib64/python3.6/http/client.py", line 1040, in _send_output
    self.send(msg)
  File "/usr/lib64/python3.6/http/client.py", line 978, in send
    self.connect()
  File "/usr/lib64/python3.6/http/client.py", line 1429, in connect
    super().connect()
  File "/usr/lib64/python3.6/http/client.py", line 950, in connect
    (self.host,self.port), self.timeout, self.source_address)
  File "/usr/lib64/python3.6/socket.py", line 704, in create_connection
    for res in getaddrinfo(host, port, 0, SOCK_STREAM):
  File "/usr/lib64/python3.6/socket.py", line 745, in getaddrinfo
    for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno -2] Name or service not known

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib64/python3.6/site-packages/subscription_manager/managercli.py", line 564, in main
    return_code = self._do_command()
  File "/usr/lib64/python3.6/site-packages/subscription_manager/managercli.py", line 3001, in _do_command
    after_date=after_date,
  File "/usr/lib64/python3.6/site-packages/rhsmlib/services/entitlement.py", line 403, in get_available_pools
    iso_dates=iso_dates
  File "/usr/lib64/python3.6/site-packages/subscription_manager/managerlib.py", line 345, in get_available_entitlements
    items_per_page=items_per_page
  File "/usr/lib64/python3.6/site-packages/subscription_manager/managerlib.py", line 569, in get_filtered_pools_list
    items_per_page=items_per_page
  File "/usr/lib64/python3.6/site-packages/subscription_manager/managerlib.py", line 279, in list_pools
    require(FACTS).update_check(uep, consumer_uuid)
  File "/usr/lib64/python3.6/site-packages/subscription_manager/cache.py", line 184, in update_check
    raise pe
  File "/usr/lib64/python3.6/site-packages/subscription_manager/cache.py", line 176, in update_check
    self._sync_with_server(uep, consumer_uuid)
  File "/usr/lib64/python3.6/site-packages/subscription_manager/facts.py", line 88, in _sync_with_server
    uep.updateConsumer(consumer_uuid, facts=self.get_facts())
  File "/usr/lib64/python3.6/site-packages/rhsm/connection.py", line 1224, in updateConsumer
    ret = self.conn.request_put(method, params)
  File "/usr/lib64/python3.6/site-packages/rhsm/connection.py", line 915, in request_put
    return self._request("PUT", method, params, headers=headers)
  File "/usr/lib64/python3.6/site-packages/rhsm/connection.py", line 932, in _request
    info=info, headers=headers, cert_key_pairs=cert_key_pairs)
  File "/usr/lib64/python3.6/site-packages/rhsm/connection.py", line 758, in _request
    err))
rhsm.connection.ProxyException: Unable to connect to: bad-proxy:3129 [Errno -2] Name or service not known 
[root@hpe-dl380pgen8-02-vm-8 ~]# 



Verified : Consistent exception "Proxy error, unable to connect to proxy server." is being raised for negative proxy tests

Comment 7 Rehana 2021-05-17 11:11:32 UTC
Verifying on : 
# subscription-manager version
server type: Red Hat Subscription Management
subscription management server: 3.2.18-1
subscription management rules: 5.41
subscription-manager: 1.28.16-1.el8

# rpm -qa --changelog subscription-manager | grep 1916540
- 1916540: Negative proxy tests occasionally encounter the wrong exception

# subscription-manager identity
system identity: *********
name: ****************
org name: *****
org ID: *****


# subscription-manager config --server.proxy_hostname=bad-proxy --server.proxy_port=3129

# subscription-manager list --available
Proxy error, unable to connect to proxy server.

# echo '{"foo":"bar"}' > /etc/rhsm/facts/custom.facts

# subscription-manager list --available
Proxy error, unable to connect to proxy server.
^^ As per the request made in the bug , the Proxy error message is now appearing on the cli


Based on the observation , Moving the bug to Verified!! 

Additional info : rhsm.log 
==========================
# tail -f /var/log/rhsm/rhsm.log -n 30
During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib64/python3.6/site-packages/subscription_manager/managercli.py", line 564, in main
    return_code = self._do_command()
  File "/usr/lib64/python3.6/site-packages/subscription_manager/managercli.py", line 3001, in _do_command
    after_date=after_date,
  File "/usr/lib64/python3.6/site-packages/rhsmlib/services/entitlement.py", line 403, in get_available_pools
    iso_dates=iso_dates
  File "/usr/lib64/python3.6/site-packages/subscription_manager/managerlib.py", line 345, in get_available_entitlements
    items_per_page=items_per_page
  File "/usr/lib64/python3.6/site-packages/subscription_manager/managerlib.py", line 569, in get_filtered_pools_list
    items_per_page=items_per_page
  File "/usr/lib64/python3.6/site-packages/subscription_manager/managerlib.py", line 279, in list_pools
    require(FACTS).update_check(uep, consumer_uuid)
  File "/usr/lib64/python3.6/site-packages/subscription_manager/cache.py", line 184, in update_check
    raise pe
  File "/usr/lib64/python3.6/site-packages/subscription_manager/cache.py", line 176, in update_check
    self._sync_with_server(uep, consumer_uuid)
  File "/usr/lib64/python3.6/site-packages/subscription_manager/facts.py", line 88, in _sync_with_server
    uep.updateConsumer(consumer_uuid, facts=self.get_facts())
  File "/usr/lib64/python3.6/site-packages/rhsm/connection.py", line 1224, in updateConsumer
    ret = self.conn.request_put(method, params)
  File "/usr/lib64/python3.6/site-packages/rhsm/connection.py", line 915, in request_put
    return self._request("PUT", method, params, headers=headers)
  File "/usr/lib64/python3.6/site-packages/rhsm/connection.py", line 932, in _request
    info=info, headers=headers, cert_key_pairs=cert_key_pairs)
  File "/usr/lib64/python3.6/site-packages/rhsm/connection.py", line 758, in _request
    err))
rhsm.connection.ProxyException: Unable to connect to: bad-proxy:3129 [Errno -2] Name or service not known

Comment 10 errata-xmlrpc 2021-11-09 19:37:35 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 (subscription-manager bug fix and enhancement update), 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-2021:4390


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