Bug 1006861

Summary: [ovirt-guest-agent] syntaxerror because of python 2.4.x on RHEL5 in /usr/share/ovirt-guest-agent/GuestAgentLinux2.py
Product: Red Hat Enterprise Virtualization Manager Reporter: Jiri Belka <jbelka>
Component: ovirt-guest-agentAssignee: Martin Betak <mbetak>
Status: CLOSED ERRATA QA Contact: Pavel Novotny <pnovotny>
Severity: urgent Docs Contact:
Priority: unspecified    
Version: 3.3.0CC: acathrow, iheim, mavital, michal.skrivanek, mkenneth, vfeenstr, yeylon
Target Milestone: ---Keywords: Regression, Triaged
Target Release: 3.3.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard: virt
Fixed In Version: is18 Doc Type: Bug Fix
Doc Text:
A syntax error in /usr/share/ovirt-guest-agent/GuestAgentLinux2.py was caused by incompatibility with python 2.4, so the guest agent failed on Red Hat Enterprise Linux 5 guests. This error is fixed by rewriting the instances of ternary operator "if" to be compatible with python 2.4. The syntax error no longer occurs.
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-01-21 15:52:28 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: 995464, 995465    

Description Jiri Belka 2013-09-11 12:11:15 UTC
Description of problem:

# /etc/init.d/ovirt-guest-agent start
Starting ovirt-guest-agent: Traceback (most recent call last):
  File "/usr/share/ovirt-guest-agent/ovirt-guest-agent.py", line 25, in ?
    from GuestAgentLinux2 import LinuxVdsAgent
  File "/usr/share/ovirt-guest-agent/GuestAgentLinux2.py", line 170
    param = '-r' if reboot else '-h'
                  ^
SyntaxError: invalid syntax
                                                           [FAILED]

# python
Python 2.4.3 (#1, Oct 23 2012, 22:02:41) 
[GCC 4.1.2 20080704 (Red Hat 4.1.2-54)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> param = '-r' if True else '-h'
  File "<stdin>", line 1
    param = '-r' if True else '-h'
                  ^
SyntaxError: invalid syntax

rhel6 comparison:

$ python
Python 2.6.6 (r266:84292, May 27 2013, 05:35:12) 
[GCC 4.4.7 20120313 (Red Hat 4.4.7-3)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> param = '-r' if True else '-h'
>>> param
'-r'


Version-Release number of selected component (if applicable):
is13

How reproducible:
100%

Steps to Reproduce:
1. start GA
2.
3.

Actual results:
FAILED because syntax error

Expected results:
happy running

Additional info:
be more conservative :)

Comment 2 Vinzenz Feenstra [evilissimo] 2013-10-01 08:21:43 UTC
Merged to u/s master branch: http://gerrit.ovirt.org/gitweb?p=ovirt-guest-agent.git;a=commit;h=7ceef1528359bea44aa2f705318bff1bbfb9d7a6

Comment 5 Pavel Novotny 2013-10-02 14:34:50 UTC
FailedQA in rhevm-guest-agent-1.0.8-4.el5ev (is17).

The problem still persists:

# rpm -q rhevm-guest-agent
rhevm-guest-agent-1.0.8-4.el5ev
# cat /etc/redhat-release 
Red Hat Enterprise Linux Server release 5.10 (Tikanga)
# /etc/init.d/ovirt-guest-agent start
Starting ovirt-guest-agent: Traceback (most recent call last):
  File "/usr/share/ovirt-guest-agent/ovirt-guest-agent.py", line 25, in ?
    from GuestAgentLinux2 import LinuxVdsAgent
  File "/usr/share/ovirt-guest-agent/GuestAgentLinux2.py", line 170
    param = '-r' if reboot else '-h'
                  ^
SyntaxError: invalid syntax
                                                           [FAILED]

Comment 6 Vinzenz Feenstra [evilissimo] 2013-10-02 14:46:34 UTC
Patch was in the build but was not applied -_-

Comment 7 Pavel Novotny 2013-10-16 16:19:37 UTC
Verified in rhevm-guest-agent-1.0.8-5.el5ev (is18).

[root@localhost ~]# cat /etc/redhat-release 
Red Hat Enterprise Linux Server release 5.10 (Tikanga)
[root@localhost ~]# /etc/init.d/ovirt-guest-agent start
Starting ovirt-guest-agent:                                [  OK  ]

Comment 9 errata-xmlrpc 2014-01-21 15:52:28 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.

http://rhn.redhat.com/errata/RHBA-2014-0057.html