Bug 1085831

Summary: [rhevh] Broken cron job 'python < /usr/share/rhn/virtualization/poller.py'
Product: Red Hat Enterprise Virtualization Manager Reporter: Jiri Belka <jbelka>
Component: ovirt-nodeAssignee: Ryan Barry <rbarry>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: low Docs Contact:
Priority: unspecified    
Version: 3.4.0CC: cshao, dfediuck, fdeutsch, gklein, gouyang, hadong, huiwa, iheim, jboggs, leiwang, rbarry, yaniwang, ycui, yeylon
Target Milestone: ---   
Target Release: 3.5.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard: node
Fixed In Version: rhev-hypervisor6-6.6-20141218.0.iso rhev-hypervisor7-7.0-20141218.0.iso Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-02-11 20:55:21 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: Node RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 1150377    
Bug Blocks: 1123329, 1142923, 1156165    

Description Jiri Belka 2014-04-09 13:10:46 UTC
Description of problem:

Putting non-existent file to pythong, as bonus there's no sendmail so output cannot be sent.

# tail cron | grep CROND
Apr  9 13:02:01 dell-r210ii-04 CROND[6206]: (root) CMD (python < /usr/share/rhn/virtualization/poller.py)
Apr  9 13:02:01 dell-r210ii-04 CROND[6208]: (CRON) EXEC FAILED (/usr/sbin/sendmail): No such file or directory
Apr  9 13:02:01 dell-r210ii-04 CROND[6204]: (root) MAIL (mailed 76 bytes of output but got status 0x0001#012)
Apr  9 13:04:01 dell-r210ii-04 CROND[6223]: (root) CMD (python < /usr/share/rhn/virtualization/poller.py)
Apr  9 13:04:01 dell-r210ii-04 CROND[6225]: (CRON) EXEC FAILED (/usr/sbin/sendmail): No such file or directory
Apr  9 13:04:01 dell-r210ii-04 CROND[6221]: (root) MAIL (mailed 76 bytes of output but got status 0x0001#012)
Apr  9 13:06:01 dell-r210ii-04 CROND[6233]: (root) CMD (python < /usr/share/rhn/virtualization/poller.py)
Apr  9 13:06:01 dell-r210ii-04 CROND[6235]: (CRON) EXEC FAILED (/usr/sbin/sendmail): No such file or directory
Apr  9 13:06:01 dell-r210ii-04 CROND[6231]: (root) MAIL (mailed 76 bytes of output but got status 0x0001#012)


# cat /etc/cron.d/rhn-virtualization.cron 
0-59/2 * * * * root python < /usr/share/rhn/virtualization/poller.py
# ls -l /usr/share/rhn/virtualization/poller.py*
-rw-r--r--. 1 root root 7679 2012-08-10 09:33 /usr/share/rhn/virtualization/poller.pyc
# python < /usr/share/rhn/virtualization/poller.pyc 
  File "<stdin>", line 1
SyntaxError: Non-ASCII character '\xd1' in file <stdin> on line 1, but no encoding declared; see http://www.python.org/peps/pep-0263.html for details

Version-Release number of selected component (if applicable):
# cat /etc/rhev-hypervisor-release 
Red Hat Enterprise Virtualization Hypervisor release 6.5 (20140408.0.el6ev)

How reproducible:
100%

Steps to Reproduce:
1. check /var/log/cron and check /etc/cron.d/rhn-virtualization.cron
2.
3.

Actual results:
wrong path in cron job, spamming cron log

Expected results:
??

Additional info:

Comment 1 Fabian Deutsch 2014-04-10 14:45:46 UTC
It's not clear to me if this is a result of our code, or a problem in an rhn package.

Comment 2 haiyang,dong 2014-04-18 03:08:30 UTC
I could reproduce this bug in Red Hat Enterprise Virtualization Hypervisor release 6.5 (20140408.0.el6ev)

Comment 3 Ryan Barry 2014-04-21 14:39:27 UTC
(In reply to Fabian Deutsch from comment #1)
> It's not clear to me if this is a result of our code, or a problem in an rhn
> package.

Multiple:

We remove the uncompiled poller.py, so the cronjob can't find it.
We remove sendmail, so cron can't mail anything

(In reply to Jiri Belka from comment #0)
> # python < /usr/share/rhn/virtualization/poller.pyc 
>   File "<stdin>", line 1
> SyntaxError: Non-ASCII character '\xd1' in file <stdin> on line 1, but no
> encoding declared; see http://www.python.org/peps/pep-0263.html for details
> 
Python will spit this out if you try to push byte-compiled files through stdin.

python /usr/share/rhn/virtualization/poller.pyc (with no stdin redirection) works, however, as can be observed if with:

python /usr/share/rhn/virtualization/poller.pyc -d

Comment 4 Fabian Deutsch 2014-07-24 16:02:31 UTC
This is a mass change, moving bugs of merged patches into MODIFIED.

Please correct the state, if you think that the move was not justified.

Comment 6 haiyang,dong 2015-01-14 07:25:51 UTC
Test version:
rhev-hypervisor6-6.6-20150112.0
ovirt-node-3.1.0-0.42.20150109gitd06b7c5.el6.noarch

Test steps:
1. [root@dhcp-9-150 admin]# cat /etc/cron.d/rhn-virtualization.cron
0-59/2 * * * * root python  /usr/share/rhn/virtualization/poller.pyc

2. [root@dhcp-9-150 admin]# ls -l /usr/share/rhn/virtualization/poller.py*
-rw-r--r--. 1 root root 7904 2014-09-29 07:28 /usr/share/rhn/virtualization/poller.pyc

3.        
[root@dhcp-9-150 admin]# tail /var/log/cron |grep poller
Jan 14 07:18:01 localhost CROND[17625]: (root) CMD (python  /usr/share/rhn/virtualization/poller.pyc)
Jan 14 07:20:01 localhost CROND[17692]: (root) CMD (python  /usr/share/rhn/virtualization/poller.pyc)

so now it used correct path in cron job, Change the status into "VERIFIED".

For OSError: [Errno 30] Read-only file system: '/var/cache/rhn'  when executing cron job 'python  /usr/share/rhn/virtualization/poller.pyc', I have report a new bug 1181937 to track that.

Comment 8 errata-xmlrpc 2015-02-11 20:55:21 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://rhn.redhat.com/errata/RHEA-2015-0160.html