Issue
Description of problem:
-----------------------
Executing subscription-manager commands in relation to listing a long list of repositories piped to less on RHEL 7 or RHEL 8 with SCA enabled results with the following output if the user does not scroll to the end:
RHEL 8:
—
subscription-manager repos --list | less
Network error, unable to connect to server. Please see /var/log/rhsm/rhsm.log for more information.
Checking /var/log/rhsm/rhsm.log, the following can be observed:
~~~
2023-05-03 11:34:54,608 [ERROR] subscription-manager:46708:MainThread @managercli.py:229 - exception caught in subscripti
on-manager
2023-05-03 11:34:54,608 [ERROR] subscription-manager:46708:MainThread @managercli.py:230 - [Errno 32] Broken pipe
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 3018, in _do_command
repo["enabled"]) + "\n")
BrokenPipeError: [Errno 32] Broken pipe
~~~
RHEL 7:
—
subscription-manager repos --list | less
~~~
Traceback (most recent call last):
File "/usr/sbin/subscription-manager", line 9, in <module>
load_entry_point('subscription-manager==1.24.51', 'console_scripts', 'subscription-manager')()
File "/usr/lib64/python2.7/site-packages/subscription_manager/scripts/subscription_manager.py", line 86, in main
return managercli.ManagerCLI().main()
File "/usr/lib64/python2.7/site-packages/subscription_manager/managercli.py", line 3070, in main
ret = CLI.main(self)
File "/usr/lib64/python2.7/site-packages/subscription_manager/cli.py", line 183, in main
return cmd.main()
File "/usr/lib64/python2.7/site-packages/subscription_manager/managercli.py", line 545, in main
return_code = self._do_command()
File "/usr/lib64/python2.7/site-packages/subscription_manager/managercli.py", line 2397, in _do_command
repo["enabled"]) + "\n")
IOError: [Errno 32] Broken pipe
~~~
Version-Release number of selected component (if applicable):
—
Red Hat Enterprise Linux release 8.7
subscription-manager-1.28.32-1.el8.x86_64
Red Hat Enterprise Linux Server release 7.9
subscription-manager-1.24.51-1.el7_9.x86_64
How reproducible:
100%
Steps to Reproduce:
—
1. On a RHEL 7 or RHEL 8 server that is using subscription-manager, execute subscription-manager command piped to less that would provide a long output.
2. Exit the less early with minimal scrolling and/or none
3. Output will be presented to the user like the examples provided above
Expected results:
—
Expect if subscription-manager command is piped to less that it would close correctly and not provide a `Network error` or `Broken pipe` output.