Bug 1860434
| Summary: | When /etc/rhsm/rhsm.conf does not exist, then it is not possible to set any option | ||
|---|---|---|---|
| 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: | high | Docs Contact: | |
| Priority: | medium | ||
| Version: | 8.2 | CC: | arpandey, jsefler, redakkan |
| Target Milestone: | rc | Keywords: | Regression, Triaged |
| Target Release: | 8.4 | 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: | 2021-05-18 13:32:41 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: | |||
| Bug Depends On: | |||
| Bug Blocks: | 1868726 | ||
|
Description
Jiri Hnidek
2020-07-24 14:40:51 UTC
Output of rhsm.log:
2020-07-24 17:11:08,128 [ERROR] subscription_manager.py:80436:MainThread @managercli.py:219 - exception caught in subscription-manager
2020-07-24 17:11:08,129 [ERROR] subscription_manager.py:80436:MainThread @managercli.py:220 - [Errno 2] No such file or directory: '/etc/rhsm/rhsm.conf'
Traceback (most recent call last):
File "/home/jhnidek/githup/candlepin/subscription-manager/src/subscription_manager/scripts/subscription_manager.py", line 96, in <module>
sys.exit(abs(main() or 0))
File "/home/jhnidek/githup/candlepin/subscription-manager/src/subscription_manager/scripts/subscription_manager.py", line 87, in main
return managercli.ManagerCLI().main()
File "/home/jhnidek/githup/candlepin/subscription-manager/src/subscription_manager/managercli.py", line 3270, in main
ret = CLI.main(self)
File "/home/jhnidek/githup/candlepin/subscription-manager/src/subscription_manager/cli.py", line 183, in main
return cmd.main()
File "/home/jhnidek/githup/candlepin/subscription-manager/src/subscription_manager/managercli.py", line 547, in main
return_code = self._do_command()
File "/home/jhnidek/githup/candlepin/subscription-manager/src/subscription_manager/managercli.py", line 2785, in _do_command
conf.persist()
File "/home/jhnidek/githup/candlepin/subscription-manager/src/rhsmlib/services/config.py", line 36, in persist
self._parser.save()
File "/home/jhnidek/githup/candlepin/subscription-manager/src/rhsm/config.py", line 143, in save
mode = os.stat(self.config_file).st_mode
FileNotFoundError: [Errno 2] No such file or directory: '/etc/rhsm/rhsm.conf'
Early Testing : Reproducing issue on subscription-manager-1.27.16-1.el8.x86_64 [root@ibm-x3650m4-02-vm-05 ~]# subscription-manager version server type: Red Hat Subscription Management subscription management server: 3.1.18-1 subscription management rules: 5.41 subscription-manager: 1.27.16-1.el8 [root@ibm-x3650m4-02-vm-05 ~]# ll /etc/rhsm/rhsm.conf ls: cannot access '/etc/rhsm/rhsm.conf': No such file or directory [root@ibm-x3650m4-02-vm-05 ~]# subscription-manager config --server.hostname=subscription.rhsm.stage.redhat.com Network error, unable to connect to server. Please see /var/log/rhsm/rhsm.log for more information. Verifying on latest master scratch build: [root@ibm-x3650m4-02-vm-05 ~]# subscription-manager version server type: Red Hat Subscription Management subscription management server: 3.1.18-1 subscription management rules: 5.41 subscription-manager: 1.28.3-1.git.10.32f43d9.el8 [root@ibm-x3650m4-02-vm-05 ~]# rpm -qa subscription-manager subscription-manager-1.28.3-1.git.10.32f43d9.el8.x86_64 [root@ibm-x3650m4-02-vm-05 ~]# ll /etc/rhsm/rhsm.conf ls: cannot access '/etc/rhsm/rhsm.conf': No such file or directory [root@ibm-x3650m4-02-vm-05 ~]# subscription-manager config –server.hostname=subscription.rhsm.stage.redhat.com [root@ibm-x3650m4-02-vm-05 ~]# cat /etc/rhsm/rhsm.conf [server] hostname = subscription.rhsm.stage.redhat.com [root@ibm-x3650m4-02-vm-05 ~]# [root@ibm-x3650m4-02-vm-05 ~]# Verifying case when /etc/rhsm directory doesn't exist [root@ibm-x3650m4-02-vm-05 ~]# rm -rf /etc/rhsm/ [root@ibm-x3650m4-02-vm-05 ~]# [root@ibm-x3650m4-02-vm-05 ~]# subscription-manager config –server.hostname=subscription.rhsm.stage.redhat.com [root@ibm-x3650m4-02-vm-05 ~]# ll /etc/rhsm/rhsm.conf -rw-r--r--. 1 root root 54 Oct 1 03:37 /etc/rhsm/rhsm.conf VERIFIED : when /etc/rhsm/rhsm.conf file or rhsm directory does not exist then new file /etc/rhsm/rhsm.conf gets created and default values are saved to this file Here is some update on Expected Results for this bug- The initial expected result is now different from the expected result that was decided after discussion with QE team. As per Initial expected result a fix for this bug was supposed to save the given config option and also restore default values in the recreated rhsm.conf Current fix for bug does not restore the default options in rhsm.conf file, which is now the expected behavior. actual result in VERIFIED section of comment 4 should not contain "default values are saved to this file". Re stating expected result and actual result for the bug- Actual Results: The option is set in new file /etc/rhsm/rhsm.conf Expected Results: The option should be set in new file /etc/rhsm/rhsm.conf Early Testing: Verifying on latest sub-man build: subscription-manager-1.28.5-1.el8.x86_64 Version-Release number of selected component (if applicable): [root@kvm-05-guest09 ~]# subscription-manager version server type: This system is currently not registered. subscription management server: 3.2.0-1 subscription management rules: 5.41 subscription-manager: 1.28.5-1.el8 Steps for verification: [root@kvm-05-guest09 ~]# rpm -qa subscription-manager --changelog | grep 1860434 - 1860434: Create rhsm.conf, when config command is used; ENT-2698 [root@kvm-05-guest09 ~]# root@kvm-05-guest09 ~]# ll /etc/rhsm/rhsm.conf ls: cannot access '/etc/rhsm/rhsm.conf': No such file or directory [root@kvm-05-guest09 ~]# subscription-manager config --server.hostname=subscription.rhsm.stage.redhat.com [root@kvm-05-guest09 ~]# cat /etc/rhsm/rhsm.conf [server] hostname = subscription.rhsm.stage.redhat.com Results: When /etc/rhsm/rhsm.conf is missing, setting configuration generates rhsm.conf and saves passed values. Verification:
Version-Release number of selected component (if applicable):
[root@kvm-01-guest25 ~]#
[root@kvm-01-guest25 ~]# subscription-manager version
server type: This system is currently not registered.
subscription management server: 3.2.0-1
subscription management rules: 5.41
subscription-manager: 1.28.5-1.el8
Steps for verification:
[root@kvm-01-guest25 ~]#
[root@kvm-01-guest25 ~]# rpm -qa subscription-manager --changelog | grep 1860434
- 1860434: Create rhsm.conf, when config command is used; ENT-2698
[root@kvm-01-guest25 ~]#
[root@kvm-01-guest25 ~]#
[root@kvm-01-guest25 ~]# ll /etc/rhsm/rhsm.conf
ls: cannot access '/etc/rhsm/rhsm.conf': No such file or directory
[root@kvm-01-guest25 ~]#
[root@kvm-01-guest25 ~]# subscription-manager config --server.hostname=subscription.rhsm.stage.redhat.com
[root@kvm-01-guest25 ~]#
[root@kvm-01-guest25 ~]# cat /etc/rhsm/rhsm.conf
[server]
hostname = subscription.rhsm.stage.redhat.com
^^^^^^ rhsm.conf gets created again and saves the values passed in config command
[root@kvm-01-guest25 ~]# cat /var/log/rhsm/rhsm.log
2020-11-16 12:40:51,518 [DEBUG] subscription-manager:17417:MainThread @https.py:56 - Using standard libs to provide httplib and ssl
2020-11-16 12:40:51,668 [DEBUG] subscription-manager:17417:MainThread @dbus_interface.py:37 - self.has_main_loop=False
2020-11-16 12:40:51,672 [DEBUG] subscription-manager:17417:MainThread @dbus_interface.py:53 - Unable to connect to D-Bus service: com.redhat.SubscriptionManager
2020-11-16 12:40:51,688 [DEBUG] subscription-manager:17417:MainThread @ga_loader.py:91 - ga_loader GaImporterGtk3
2020-11-16 12:40:51,689 [DEBUG] subscription-manager:17417:MainThread @plugins.py:571 - loaded plugin modules: []
2020-11-16 12:40:51,690 [DEBUG] subscription-manager:17417:MainThread @plugins.py:572 - loaded plugins: {}
2020-11-16 12:40:51,690 [DEBUG] subscription-manager:17417:MainThread @identity.py:139 - Loading consumer info from identity certificates.
2020-11-16 12:40:51,690 [DEBUG] subscription-manager:17417:MainThread @identity.py:154 - Reload of consumer identity cert /etc/pki/consumer/cert.pem raised an exception with msg: [Errno 2] No such file or directory: '/etc/pki/consumer/key.pem'
2020-11-16 12:40:51,697 [DEBUG] subscription-manager:17417:MainThread @managercli.py:502 - X-Correlation-ID: 0d3d1202604a4d26ace47c042179ce1c
2020-11-16 12:40:51,697 [DEBUG] subscription-manager:17417:MainThread @managercli.py:391 - Client Versions: {'subscription-manager': '1.28.5-1.el8'}
2020-11-16 12:40:51,697 [DEBUG] subscription-manager:17417:MainThread @connection.py:171 - Environment variable NO_PROXY= will be used
2020-11-16 12:40:51,697 [DEBUG] subscription-manager:17417:MainThread @connection.py:267 - Connection built: host=subscription.rhsm.stage.redhat.com port=443 handler=/subscription auth=identity_cert ca_dir=/etc/rhsm/ca/ insecure=False
2020-11-16 12:40:51,698 [DEBUG] subscription-manager:17417:MainThread @connection.py:171 - Environment variable NO_PROXY= will be used
2020-11-16 12:40:51,698 [DEBUG] subscription-manager:17417:MainThread @connection.py:267 - Connection built: host=subscription.rhsm.stage.redhat.com port=443 handler=/subscription auth=none
2020-11-16 12:40:51,698 [DEBUG] subscription-manager:17417:MainThread @connection.py:698 - Making request: GET /subscription/
2020-11-16 12:40:51,700 [DEBUG] subscription-manager:17417:MainThread @connection.py:556 - Loaded CA certificates from /etc/rhsm/ca/: redhat-entitlement-authority.pem, redhat-uep.pem
2020-11-16 12:40:52,722 [DEBUG] subscription-manager:17417:MainThread @connection.py:792 - Response time: 0.817096471786499, Smoothed response time: 0.817096471786499
2020-11-16 12:40:52,723 [DEBUG] subscription-manager:17417:MainThread @connection.py:769 - Response: status=200, requestUuid=34b4c013-4e0f-4fc5-8a51-318ded08da97, request="GET /subscription/"
2020-11-16 12:40:52,723 [DEBUG] subscription-manager:17417:MainThread @connection.py:969 - Server supports the following resources: {'content_overrides': '/consumers/{consumer_uuid}/content_overrides', 'admin': '/admin', 'products': '/products', '': '/', 'rules': '/rules', 'consumertypes': '/consumertypes', 'pools': '/pools', 'owners': '/owners', 'deleted_consumers': '/deleted_consumers', 'jobs': '/jobs', 'subscriptions': '/subscriptions', 'crl': '/crl', 'content': '/content', 'entitlements': '/entitlements', 'status': '/status', 'roles': '/roles', 'distributor_versions': '/distributor_versions', 'guestids': '/consumers/{consumer_uuid}/guestids', 'activation_keys': '/activation_keys', 'users': '/users', 'cdn': '/cdn', 'serials': '/serials', 'consumers': '/consumers', 'hypervisors': '/hypervisors', 'packages': '/consumers/{consumer_uuid}/packages'}
2020-11-16 12:40:52,724 [DEBUG] subscription-manager:17417:MainThread @connection.py:698 - Making request: GET /subscription/status
2020-11-16 12:40:52,724 [DEBUG] subscription-manager:17417:MainThread @connection.py:556 - Loaded CA certificates from /etc/rhsm/ca/: redhat-entitlement-authority.pem, redhat-uep.pem
2020-11-16 12:40:53,744 [DEBUG] subscription-manager:17417:MainThread @connection.py:792 - Response time: 0.8138899803161621, Smoothed response time: 0.8138899803161621
2020-11-16 12:40:53,744 [DEBUG] subscription-manager:17417:MainThread @connection.py:769 - Response: status=200, requestUuid=9675e442-cc65-41b6-9980-78fbe76d42e3, request="GET /subscription/status"
2020-11-16 12:40:53,744 [DEBUG] subscription-manager:17417:MainThread @managercli.py:402 - Server Versions: {'candlepin': '3.2.0-1', 'server-type': 'This system is currently not registered.', 'rules-version': '5.41'}
2020-11-16 12:40:53,745 [DEBUG] subscription-manager:17417:MainThread @repolib.py:175 - The rhsm.auto_enable_yum_plugins is enabled
2020-11-16 12:40:53,745 [DEBUG] subscription-manager:17417:MainThread @repolib.py:151 - dnf plugin: "/etc/dnf/plugins/subscription-manager.conf" already enabled. Nothing to do.
2020-11-16 12:40:53,745 [DEBUG] subscription-manager:17417:MainThread @repolib.py:151 - dnf plugin: "/etc/dnf/plugins/product-id.conf" already enabled. Nothing to do.
2020-11-16 12:40:53,746 [DEBUG] subscription-manager:17417:MainThread @repolib.py:151 - yum plugin: "/etc/yum/pluginconf.d/subscription-manager.conf" already enabled. Nothing to do.
2020-11-16 12:40:53,746 [DEBUG] subscription-manager:17417:MainThread @repolib.py:151 - yum plugin: "/etc/yum/pluginconf.d/product-id.conf" already enabled. Nothing to do.
[root@kvm-01-guest25 ~]#
^^^^^^^^ No traceback in rhsm log for missing rhsm.conf
Result : Config values passed in subscription-manager config command gets saved in new rhsm.conf file
Additional Info: Issue did not exist on RHEL 7.9, subscription-manager: 1.24.42-1.el7 Therefore adding Regression keyword for future reference [root@kvm-06-guest21 ~]# subscription-manager version server type: This system is currently not registered. subscription management server: 3.2.0-1 subscription management rules: 5.41 subscription-manager: 1.24.42-1.el7 [root@kvm-06-guest21 ~]# rm -f /etc/rhsm/rhsm.conf [root@kvm-06-guest21 ~]# [root@kvm-06-guest21 ~]# subscription-manager config --server.hostname=subscription.rhsm.stage.redhat.com [root@kvm-06-guest21 ~]# [root@kvm-06-guest21 ~]# cat /etc/rhsm/rhsm.conf [server] hostname = subscription.rhsm.stage.redhat.com ^^^ rhsm.conf gets created 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:1575 |