Bug 1821747
| Summary: | Any subscription-manager command is terminated, when /etc/rhsm/syspurpose directory does not exist | ||
|---|---|---|---|
| Product: | Red Hat Enterprise Linux 8 | Reporter: | Jiri Hnidek <jhnidek> |
| Component: | subscription-manager | Assignee: | Jiri Hnidek <jhnidek> |
| Status: | CLOSED ERRATA | QA Contact: | Red Hat subscription-manager QE Team <rhsm-qe> |
| Severity: | unspecified | Docs Contact: | |
| Priority: | unspecified | ||
| Version: | 8.1 | CC: | jsefler, redakkan, skallesh, wpoteat |
| Target Milestone: | rc | Keywords: | Triaged |
| Target Release: | 8.0 | Flags: | pm-rhel:
mirror+
|
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
| Whiteboard: | |||
| Fixed In Version: | Doc Type: | If docs needed, set a value | |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2020-11-04 01:39:09 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: | |||
When directory /var/lib/rhsm/cache does not exist, then subscription-manager is terminated with similar error. It should be fixed in the provided PR. reproducer:
[root@kvm-02-guest16 ~]# subscription-manager version
server type: This system is currently not registered.
subscription management server: 2.9.27-1
subscription management rules: 5.37
subscription-manager: 1.26.12-1.el8
[root@kvm-02-guest16 ~]# rm -rf /etc/rhsm/syspurpose/
[root@kvm-02-guest16 ~]# subscription-manager version
Traceback (most recent call last):
File "/usr/lib/python3.6/site-packages/syspurpose/files.py", line 325, in get_local_contents
self.local_contents = json.load(io.open(self.path, 'r', encoding='utf-8'))
FileNotFoundError: [Errno 2] No such file or directory: '/etc/rhsm/syspurpose/syspurpose.json'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/sbin/subscription-manager", line 11, in <module>
load_entry_point('subscription-manager==1.26.12', 'console_scripts', 'subscription-manager')()
File "/usr/lib64/python3.6/site-packages/subscription_manager/scripts/subscription_manager.py", line 86, in main
return managercli.ManagerCLI().main()
File "/usr/lib64/python3.6/site-packages/subscription_manager/managercli.py", line 2992, in __init__
CLI.__init__(self, command_classes=commands)
File "/usr/lib64/python3.6/site-packages/subscription_manager/cli.py", line 101, in __init__
cmd = clazz()
File "/usr/lib64/python3.6/site-packages/subscription_manager/managercli.py", line 1571, in __init__
attr='addons', commands=['unset', 'add', 'remove'])
File "/usr/lib64/python3.6/site-packages/subscription_manager/managercli.py", line 565, in __init__
self.store = self._get_synced_store()
File "/usr/lib64/python3.6/site-packages/subscription_manager/managercli.py", line 601, in _get_synced_store
return SyncedStore(uep=uep, consumer_uuid=self.identity.uuid)
File "/usr/lib/python3.6/site-packages/syspurpose/files.py", line 252, in __init__
self.local_contents = self.get_local_contents()
File "/usr/lib/python3.6/site-packages/syspurpose/files.py", line 335, in get_local_contents
self.update_local({})
File "/usr/lib/python3.6/site-packages/syspurpose/files.py", line 372, in update_local
return self.update_file(self.path, data)
File "/usr/lib/python3.6/site-packages/syspurpose/files.py", line 505, in update_file
f = io.open(path, mode, encoding='utf-8')
FileNotFoundError: [Errno 2] No such file or directory: '/etc/rhsm/syspurpose/syspurpose.json'
[root@kvm-02-guest16 ~]#
Verification:
[root@kvm-06-guest05 ~]# subscription-manager version
server type: This system is currently not registered.
subscription management server: 2.9.27-1
subscription management rules: 5.37
subscription-manager: 1.27.3
[root@kvm-06-guest05 ~]# rm -rf /etc/rhsm/syspurpose/
[root@kvm-06-guest05 ~]# ls /etc/rhsm/syspurpose/syspurpose.json
ls: cannot access '/etc/rhsm/syspurpose/syspurpose.json': No such file or directory
[root@kvm-06-guest05 ~]# subscription-manager version
server type: This system is currently not registered.
subscription management server: 2.9.27-1
subscription management rules: 5.37
subscription-manager: 1.27.3
^^ no traceback , version is displayed properly
[root@kvm-06-guest05 ~]# cat /etc/rhsm/syspurpose/syspurpose.json
{}
[root@kvm-06-guest05 ~]# rm -rf /etc/rhsm/syspurpose/
[root@kvm-06-guest05 ~]# ls /etc/rhsm/syspurpose/syspurpose.json
ls: cannot access '/etc/rhsm/syspurpose/syspurpose.json': No such file or directory
[root@kvm-06-guest05 ~]# subscription-manager clean
All local data removed
^^ no traceback again
[root@kvm-06-guest05 ~]# cat /etc/rhsm/syspurpose/syspurpose.json
{}[root@kvm-06-guest05 ~]#
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-2020:4460 |
Description of problem: When directory /etc/rhsm/syspurpose is missing, then any subscription-manager command is terminated. Version-Release number of selected component (if applicable): [root@localhost ~]# subscription-manager version server type: Red Hat Subscription Management subscription management server: 2.9.21-1 subscription management rules: 5.37 subscription-manager: 1.26.12-1.el8 How reproducible: 100% Steps to Reproduce: 1. Delete directory /etc/rhsm/syspurpose [root@localhost ~]# rm -rf /etc/rhsm/syspurpose/ 2. Try to run any subscription-manager command [root@localhost ~]# subscription-manager version Actual results: [Errno 2] No such file or directory: '/etc/rhsm/syspurpose/syspurpose.json' Expected results: Directory /etc/rhsm/syspurpose/ is created and /etc/rhsm/syspurpose/syspurpose.json with content: '{}' is also created. Additional info: Content of rhsm.log 2020-04-07 15:51:12,033 [ERROR] subscription_manager.py:4807:MainThread @managercli.py:216 - exception caught in subscription-manager 2020-04-07 15:51:12,033 [ERROR] subscription_manager.py:4807:MainThread @managercli.py:217 - [Errno 2] No such file or directory: '/etc/rhsm/syspurpose/syspurpose.json' Traceback (most recent call last): File "/home/jiri/github/candlepin/subscription_manager/src/subscription_manager/scripts/subscription_manager.py", line 96, in <module> sys.exit(abs(main() or 0)) File "/home/jiri/github/candlepin/subscription_manager/src/subscription_manager/scripts/subscription_manager.py", line 87, in main return managercli.ManagerCLI().main() File "/home/jiri/github/candlepin/subscription_manager/src/subscription_manager/managercli.py", line 3068, in __init__ CLI.__init__(self, command_classes=commands) File "/home/jiri/github/candlepin/subscription_manager/src/subscription_manager/cli.py", line 101, in __init__ cmd = clazz() File "/home/jiri/github/candlepin/subscription_manager/src/subscription_manager/managercli.py", line 1636, in __init__ attr='addons', commands=['unset', 'add', 'remove']) File "/home/jiri/github/candlepin/subscription_manager/src/subscription_manager/managercli.py", line 573, in __init__ self.store = self._get_synced_store() File "/home/jiri/github/candlepin/subscription_manager/src/subscription_manager/managercli.py", line 609, in _get_synced_store return SyncedStore(uep=uep, consumer_uuid=self.identity.uuid) File "/home/jiri/github/candlepin/subscription_manager/syspurpose/src/syspurpose/files.py", line 252, in __init__ self.local_contents = self.get_local_contents() File "/home/jiri/github/candlepin/subscription_manager/syspurpose/src/syspurpose/files.py", line 335, in get_local_contents self.update_local({}) File "/home/jiri/github/candlepin/subscription_manager/syspurpose/src/syspurpose/files.py", line 372, in update_local return self.update_file(self.path, data) File "/home/jiri/github/candlepin/subscription_manager/syspurpose/src/syspurpose/files.py", line 505, in update_file f = io.open(path, mode, encoding='utf-8') IOError: [Errno 2] No such file or directory: '/etc/rhsm/syspurpose/syspurpose.json' It also worth to mention that syspurpose command has similar problem and creating /etc/rhsm/syspurpose fixes this issue: [root@localhost ~]# syspurpose show [Errno 2] No such file or directory: '/etc/rhsm/syspurpose/syspurpose.json' [root@localhost ~]# mkdir /etc/rhsm/syspurpose/ [root@localhost ~]# subscription-manager version server type: Red Hat Subscription Management subscription management server: 2.9.21-1 subscription management rules: 5.37 subscription-manager: 1.26.12-1.el8 [root@localhost subscription_manager]# syspurpose show {}