Bug 1653387
| Summary: | syspurpose file contents are restored after the cert check post the file is manually deleted | ||
|---|---|---|---|
| Product: | Red Hat Enterprise Linux 8 | Reporter: | Rehana <redakkan> |
| Component: | subscription-manager | Assignee: | candlepin-bugs |
| Status: | CLOSED CURRENTRELEASE | QA Contact: | Red Hat subscription-manager QE Team <rhsm-qe> |
| Severity: | unspecified | Docs Contact: | |
| Priority: | unspecified | ||
| Version: | 8.0 | CC: | cdonnell, csnyder, khowell, redakkan |
| 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-12-15 09:05:22 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: | |||
This also breaks for making changes directly to the file:
[root@unused ~]# vi /etc/rhsm/syspurpose/syspurpose.json
[root@unused ~]# syspurpose show
{
"usage": "QA",
"addons": [],
"role": "RHEL Workstation",
"service_level_agreement": "Premium"
}
[root@unused ~]# systemctl restart rhsmcertd
[root@unused ~]# systemctl status rhsmcertd
● rhsmcertd.service - Enable periodic update of entitlement certificates.
Loaded: loaded (/usr/lib/systemd/system/rhsmcertd.service; enabled; vendor preset: enabled)
Active: active (running) since Tue 2018-11-27 12:36:51 EST; 5s ago
Process: 9380 ExecStart=/usr/bin/rhsmcertd (code=exited, status=0/SUCCESS)
Main PID: 9381 (rhsmcertd)
Tasks: 1 (limit: 25030)
Memory: 284.0K
CGroup: /system.slice/rhsmcertd.service
└─9381 /usr/bin/rhsmcertd
Nov 27 12:36:51 unused systemd[1]: Stopped Enable periodic update of entitlement certificates..
Nov 27 12:36:51 unused systemd[1]: Starting Enable periodic update of entitlement certificates....
Nov 27 12:36:51 unused systemd[1]: Started Enable periodic update of entitlement certificates..
[root@unused ~]# tail -f /var/log/rhsm/rhsmcertd.log
Tue Nov 27 03:38:55 2018 [INFO] (Cert Check) Certificates updated.
Tue Nov 27 07:38:56 2018 [INFO] (Cert Check) Certificates updated.
Tue Nov 27 10:25:55 2018 [INFO] (Auto-attach) Certificates updated.
Tue Nov 27 11:38:56 2018 [INFO] (Cert Check) Certificates updated.
Tue Nov 27 12:36:51 2018 [INFO] rhsmcertd is shutting down...
Tue Nov 27 12:36:51 2018 [INFO] Starting rhsmcertd...
Tue Nov 27 12:36:51 2018 [INFO] Auto-attach interval: 1440.0 minutes [86400 seconds]
Tue Nov 27 12:36:51 2018 [INFO] Cert check interval: 240.0 minutes [14400 seconds]
Tue Nov 27 12:36:51 2018 [INFO] Waiting 2.0 minutes plus 0 splay seconds [120 seconds total] before performing first auto-attach.
Tue Nov 27 12:36:51 2018 [INFO] Waiting 2.0 minutes plus 0 splay seconds [120 seconds total] before performing first cert check.
Tue Nov 27 12:38:55 2018 [INFO] (Cert Check) Certificates updated.
Tue Nov 27 12:38:57 2018 [INFO] (Auto-attach) Certificates updated.
^C
[root@unused ~]# syspurpose show
{
"addons": [
""
],
"service_level_agreement": "Premium",
"usage": "QA",
"role": "RHEL Server"
}
Please retest with the Snap 3 compose (subman version 1.23.8-6 or greater). # subscription-manager version
server type: Red Hat Subscription Management
subscription management server: 2.3.12-1
subscription management rules: 5.30
subscription-manager: 1.23.8-12.el8
[root@kvm-01-guest29 ~]# syspurpose show
{
"addons": [
"Addons1",
"Addons2"
],
"role": "RHEL Server",
"service_level_agreement": "Self-Support",
"usage": "QA"
}
System purpose successfully sent to subscription management server.
[root@kvm-01-guest29 ~]# rm -rf /etc/rhsm/syspurpose/syspurpose.json
[root@kvm-01-guest29 ~]# cat /etc/rhsm/syspurpose/syspurpose.json
cat: /etc/rhsm/syspurpose/syspurpose.json: No such file or directory
Wait for the certcheck to complete,
[root@kvm-01-guest29 ~]# tail -f /var/log/rhsm/rhsmcertd.log
Mon Jan 7 10:33:20 2019 [INFO] (Cert Check) Certificates updated.
[root@kvm-01-guest29 ~]# syspurpose show
{}
System purpose successfully sent to subscription management server.
rhsm.log:
========
2019-01-07 10:33:20,548 [DEBUG] rhsmcertd-worker:2599:MainThread @syspurposelib.py:204 - Syspurpose updated: Syspurpose Sync
status: Successfully synced system purpose
updates: 'role' removed by change from /etc/rhsm/syspurpose/syspurpose.json
'usage' removed by change from /etc/rhsm/syspurpose/syspurpose.json
'addons' removed by change from /etc/rhsm/syspurpose/syspurpose.json
'service_level_agreement' removed by change from /etc/rhsm/syspurpose/syspurpose.json
exceptions:
Observed that now the files are not restored , and the syspurpose.json file is set to {} also edits made in the file are not lost after the certcheck
Verifying on :
=============
# subscription-manager version
server type: Red Hat Subscription Management
subscription management server: 2.3.12-1
subscription management rules: 5.30
subscription-manager: 1.23.8-14.el8
Scenario 1 : Verify the data is NOT restored when syspurpose.json file is deleted
=============================================================================
Make sure the system is registered and have some syspurpose values set
# syspurpose show
{
"addons": [
"High Availability"
],
"role": "Red Hat Enterprise Linux Server",
"service_level_agreement": "Premium",
"usage": "QA"
}
System purpose successfully sent to subscription management server.
Delete the syspurpose.json file and wait for rhsmcertd check to happen
# rm -rf /etc/rhsm/syspurpose/syspurpose.json
# cat /etc/rhsm/syspurpose/syspurpose.json
cat: /etc/rhsm/syspurpose/syspurpose.json: No such file or directory
tail rhsmcertd.log
==================
Wed Jan 16 02:48:52 2019 [INFO] Waiting 2.0 minutes plus 0 splay seconds [120 seconds total] before performing first auto-attach.
Wed Jan 16 02:48:52 2019 [INFO] Waiting 2.0 minutes plus 0 splay seconds [120 seconds total] before performing first cert check.
Wed Jan 16 02:50:56 2019 [INFO] (Cert Check) Certificates updated.
Wed Jan 16 02:51:02 2019 [INFO] (Auto-attach) Certificates updated.
rhsm.log
=========
2019-01-16 02:54:00,591 [DEBUG] rhsmcertd-worker:18292:MainThread @files.py:381 - Successfully updated remote syspurpose on the server.
2019-01-16 02:54:00,591 [DEBUG] rhsmcertd-worker:18292:MainThread @files.py:502 - Successfully updated syspurpose values at '/etc/rhsm/syspurpose/syspurpose.json'.
2019-01-16 02:54:00,591 [DEBUG] rhsmcertd-worker:18292:MainThread @files.py:502 - Successfully updated syspurpose values at '/var/lib/rhsm/cache/syspurpose.json'.
2019-01-16 02:54:00,592 [DEBUG] rhsmcertd-worker:18292:MainThread @files.py:292 - Successfully synced system purpose.
2019-01-16 02:54:00,592 [DEBUG] rhsmcertd-worker:18292:MainThread @syspurposelib.py:204 - Syspurpose updated: Syspurpose Sync
status: Successfully synced system purpose
updates: 'usage' removed by change from /etc/rhsm/syspurpose/syspurpose.json
'addons' removed by change from /etc/rhsm/syspurpose/syspurpose.json
'role' removed by change from /etc/rhsm/syspurpose/syspurpose.json
'service_level_agreement' removed by change from /etc/rhsm/syspurpose/syspurpose.json
exceptions:
Observed that now the files are not restored ,
# syspurpose show
{}
System purpose successfully sent to subscription management server.
Scenario 2 : Verify the manual edits made in the syspurpose.json file are not lost after the rhsmcert check run
===============================================================================================================
Modify the usage value to"Production" manually
#syspurpose show
{
"addons": [
"High Availability"
],
"role": "Red Hat Enterprise Linux Server",
"service_level_agreement": "Premium",
"usage": "QA"
}
System purpose successfully sent to subscription management server.
# vi /etc/rhsm/syspurpose/syspurpose.json
# cat /etc/rhsm/syspurpose/syspurpose.json
{
"addons": [
"High Availability"
],
"role": "Red Hat Enterprise Linux Server",
"service_level_agreement": "Premium",
"usage": "Production" ==> updated to 'Production' manually
}
Wait for rhsmcert check to happen and Verify the usage is set to the new value "production"
Based on the above observations , moving the bug to verified .
# cat /etc/rhsm/syspurpose/syspurpose.json
{
"addons": [
"High Availability"
],
"role": "Red Hat Enterprise Linux Server",
"service_level_agreement": "Premium",
"usage": "Production"
}[root@kvm-02-guest09 ~]# syspurpose show
{
"addons": [
"High Availability"
],
"role": "Red Hat Enterprise Linux Server",
"service_level_agreement": "Premium",
"usage": "Production"
}
rhsm.log :
========
2019-01-16 02:57:00,654 [DEBUG] rhsmcertd-worker:18440:MainThread @files.py:292 - Successfully synced system purpose.
2019-01-16 02:57:00,654 [DEBUG] rhsmcertd-worker:18440:MainThread @syspurposelib.py:204 - Syspurpose updated: Syspurpose Sync
status: Successfully synced system purpose
updates: 'usage' updated from 'QA' to 'Production' due to change in /etc/rhsm/syspurpose/syspurpose.json
exceptions:
Observed that usage is now set to the new value "Production"
Conclusion:
Verifying the bug, based on the results of scenarion 1 and 2 .
|
Description of problem: syspurpose file contents are restored after the cert check post the file is manually deleted Version-Release number of selected component (if applicable): subscription management server: 2.3.10-1 subscription management rules: 5.29 subscription-manager: 1.23.8-1.el8 How reproducible: Not always Steps to Reproduce: 1.set some values for systempurpose attributes ex: # syspurpose show { "addons": [ "Resilient storage", "foo" ], "service_level_agreement": "", "usage": "Product", "role": "RHEL Server" } 2.set certcheck to a shorter duration say for ex: 3mins 3.manually remove syspurpose.json file ,ex : rm -rf /etc/rhsm/syspurpose/syspurpose.json Ex: [root@cav-sabre-cn99xx-01 ~]# rm -rf /etc/rhsm/syspurpose/syspurpose.json [root@cav-sabre-cn99xx-01 ~]# syspurpose show {} 4. Wait for the cert check to finish and execute syspurpose show Actual results: Notice that the value set at step 1 was restored Expected results: It is expected the file to unset all the system purpose attributes once the file is remove manually and no restoration of the file is expected. Additional info: