Bug 1794653

Summary: /etc/cron.daily/rhsmd gives error sleep: missing operand
Product: Red Hat Enterprise Linux 8 Reporter: Michael Young <m.a.young>
Component: subscription-managerAssignee: candlepin-bugs
Status: CLOSED ERRATA QA Contact: Red Hat subscription-manager QE Team <rhsm-qe>
Severity: low Docs Contact:
Priority: low    
Version: 8.2CC: cdonnell, csnyder, jsefler, mhoward, mvanderw, rbeyel, redakkan, skallesh
Target Milestone: rcKeywords: Triaged
Target Release: 8.0Flags: pm-rhel: mirror+
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: subscription-manager-1.26.11-1 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1803794 (view as bug list) Environment:
Last Closed: 2020-04-28 16:54:53 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: 1803794    

Description Michael Young 2020-01-24 09:07:19 UTC
I am getting an error from the /etc/cron.daily/rhsmd cron job in subscription-manager-1.26.9-1.el8.x86_64 on RHEL 8.2 beta. The error message is

/etc/cron.daily/rhsmd:

sleep: missing operand
Try 'sleep --help' for more information.
/etc/cron.daily/rhsmd: line 19:  8215 Terminated
/usr/libexec/rhsmd -s

I believe this is because I don't have a processTimeout line in /etc/rhsm/rhsm.conf so $config from line 5 is the empty string
However the if clause starting at line 6 is 
if [ -n $config ]; then
  rhsmd_timeout=$config
else
  rhsmd_timeout=300
fi

so line 6 test is now
if [ -n ]; then
which is true so rhsmd_timeout is set to the empty string
I think line 6 should be
if [ -n "$config" ]; then
so the line 6 would be
if [ -n "" ]; then
which is false so rhsmd_timeout gets set to 300 as intended

Comment 4 Shwetha Kallesh 2020-03-12 12:35:43 UTC
Reproducer :

[root@kvm-guest-02 ~]# subscription-manager version
server type: This system is currently not registered.
subscription management server: 2.9.21-1
subscription management rules: 5.37
subscription-manager: 1.26.9-1.el8


[root@kvm-guest-02 ~]# run-parts /etc/cron.daily
/etc/cron.daily/rhsmd:

sleep: missing operand
Try 'sleep --help' for more information.
/etc/cron.daily/rhsmd: line 19:  5007 Terminated              /usr/libexec/rhsmd -s
[root@kvm-guest-02 ~]# cat /etc/rhsm/rhsm.conf | grep process
# The time in seconds we will allow the rhsmd cron job to run before terminating the process.

Comment 5 Shwetha Kallesh 2020-03-12 12:37:34 UTC
Verification:

[root@kvm-08-guest19 ~]# subscription-manager version
server type: This system is currently not registered.
subscription management server: 2.9.21-1
subscription management rules: 5.37
subscription-manager: 1.26.14-1.el8


[root@kvm-08-guest19 ~]# cat /etc/rhsm/rhsm.conf | grep process
# The time in seconds we will allow the rhsmd cron job to run before terminating the process.

[root@kvm-08-guest19 ~]# run-parts /etc/cron.daily
[root@kvm-08-guest19 ~]#

Comment 9 errata-xmlrpc 2020-04-28 16:54:53 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-2020:1849