Bug 1440934

Summary: rhsmcertd is not starting the Auto-attach interval
Product: Red Hat Enterprise Linux 7 Reporter: John Sefler <jsefler>
Component: subscription-managerAssignee: Chris Snyder <csnyder>
Status: CLOSED ERRATA QA Contact: John Sefler <jsefler>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 7.4CC: csnyder, khowell, redakkan, skallesh
Target Milestone: rcKeywords: Regression
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: subscription-manager-1.19.7-1.el7 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-08-01 19:22:43 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:

Description John Sefler 2017-04-10 19:00:58 UTC
Description of problem:
I believe this pull request introduced a regression in the rhsmcertd process...
  https://github.com/candlepin/subscription-manager/pull/1577

When restarting the rhsmcertd process, there are two intervals started... autoAttachInterval=1440 and certCheckInterval=240.  Unfortunately only the certCheckInterval appears to be started (twice).

In addition to fixing this, also consider Problem 2 described in the Actual Results below.

Version-Release number of selected component (if applicable):
[root@jsefler-rhel7 ~]# rpm -q subscription-manager python-rhsm
subscription-manager-1.19.5-1.git.14.4f78930.el7.x86_64
python-rhsm-1.19.3-1.git.4.4f78930.el7.x86_64


How reproducible:


Steps to Reproduce:
While successfully registered to an entitlement server...
[root@jsefler-rhel7 ~]# subscription-manager config | grep rhsmcertd -A3
[rhsmcertd]
   autoattachinterval = [1440]
   certcheckinterval = [240]
   maxsplayminutes = 10

[root@jsefler-rhel7 ~]# systemctl restart rhsmcertd.service

[root@jsefler-rhel7 ~]# tail -f /var/log/rhsm/rhsmcertd.log
Mon Apr 10 14:44:41 2017 [INFO] rhsmcertd is shutting down...
Mon Apr 10 14:44:41 2017 [INFO] Starting rhsmcertd...
Mon Apr 10 14:44:41 2017 [INFO] Auto-attach interval: 1440.0 minute(s) [86400 second(s)]
Mon Apr 10 14:44:41 2017 [INFO] Cert check interval: 240.0 minute(s) [14400 second(s)]
Mon Apr 10 14:44:41 2017 [INFO] Waiting 120 second(s) [2.0 minute(s)] before running updates.
Mon Apr 10 14:46:42 2017 [INFO] (Cert Check) Certificates updated.
Mon Apr 10 14:46:42 2017 [INFO] (Cert Check) Certificates updated.


Actual results:
Problem 1:
Mon Apr 10 14:46:42 2017 [INFO] (Cert Check) Certificates updated. <---- EXPECTED "(Auto-attach) Certificates updated."
Mon Apr 10 14:46:42 2017 [INFO] (Cert Check) Certificates updated.

Problem 2:
If new RFE Bug 1435013 is working, then the timestamp on the (Cert Check) should have been something more than 2 minutes up to a max of 10 minutes as set by the new maxsplayminutes.  To be more explicit in the rhsmcertd log, can you add another INFO LOG after the [INFO] Waiting 120 second(s) that says something like this...
Mon Apr 10 14:46:41 2017 [INFO] Delaying an additional random N second(s) before running updates.

Expected results:
It appears that (Cert Check) is called twice instead of (Auto-attach) and (Cert Check)

Additional info:

Comment 2 Chris Snyder 2017-04-10 19:41:17 UTC
Adding an external tracker to a PR that should fix this.

Waiting on review.

Comment 4 Shwetha Kallesh 2017-04-13 09:46:54 UTC
verified

[root@bkr-hv03-guest33 ~]# subscription-manager register --force
The system with UUID 700665b9-fab6-44ad-b791-4d1e7cf233c7 has been unregistered
Registering to: subscription.rhn.stage.redhat.com:443/subscription
Username: shwetha_tier1_test
Password: 
The system has been registered with ID: 1236f369-d434-40e5-ad90-34dfd249ab80 
[root@bkr-hv03-guest33 ~]# subscription-manager config | grep rhsmcertd -A3
[rhsmcertd]
   autoattachinterval = [1440]
   certcheckinterval = [240]

[root@bkr-hv03-guest33 ~]# systemctl restart rhsmcertd.service
[root@bkr-hv03-guest33 ~]# tail -f /var/log/rhsm/rhsmcertd.log 
Wed Apr 12 00:09:55 2017 [INFO] Auto-attach interval: 1440.0 minute(s) [86400 second(s)]
Wed Apr 12 00:09:55 2017 [INFO] Cert check interval: 240.0 minute(s) [14400 second(s)]
Wed Apr 12 00:09:55 2017 [INFO] Waiting 120 second(s) [2.0 minute(s)] before running updates.
Wed Apr 12 00:11:56 2017 [WARN] (Auto-attach) Update failed (255), retry will occur on next run.
Wed Apr 12 00:11:56 2017 [WARN] (Cert Check) Update failed (255), retry will occur on next run.
Wed Apr 12 03:04:21 2017 [INFO] rhsmcertd is shutting down...
Thu Apr 13 05:43:27 2017 [INFO] Starting rhsmcertd...
Thu Apr 13 05:43:27 2017 [INFO] Auto-attach interval: 1440.0 minute(s) [86400 second(s)]
Thu Apr 13 05:43:27 2017 [INFO] Cert check interval: 240.0 minute(s) [14400 second(s)]
Thu Apr 13 05:43:27 2017 [INFO] Waiting 120 second(s) [2.0 minute(s)] before running updates.

Thu Apr 13 05:45:38 2017 [INFO] (Auto-attach) Certificates updated.
Thu Apr 13 05:45:43 2017 [INFO] (Cert Check) Certificates updated.


^C
[root@bkr-hv03-guest33 ~]# subscription-manager list --installed

+-------------------------------------------+
    Installed Product Status
+-------------------------------------------+
Product Name:   Red Hat Enterprise Linux Server
Product ID:     69
Version:        7.4 Beta
Arch:           x86_64
Status:         Subscribed
Status Details: 
Starts:         04/10/2017
Ends:           04/25/2017

Comment 5 errata-xmlrpc 2017-08-01 19:22:43 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, 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-2017:2083