[ovirt-guest-agent/el5] Added python2.4 syntax patch
Vinzenz Feenstra
evilissimo at fedoraproject.org
Mon Nov 25 10:10:13 UTC 2013
commit d8d922847db8fc9bc702697a56e9c1fded520e95
Author: Vinzenz Feenstra <vfeenstr at redhat.com>
Date: Mon Nov 25 11:09:47 2013 +0100
Added python2.4 syntax patch
Signed-off-by: Vinzenz Feenstra <vfeenstr at redhat.com>
0001-agent-Fix-python-2.4-compatibility.patch | 78 +++++++++++++++++++++++++
ovirt-guest-agent.spec | 9 +++-
2 files changed, 86 insertions(+), 1 deletions(-)
---
diff --git a/0001-agent-Fix-python-2.4-compatibility.patch b/0001-agent-Fix-python-2.4-compatibility.patch
new file mode 100644
index 0000000..55646aa
--- /dev/null
+++ b/0001-agent-Fix-python-2.4-compatibility.patch
@@ -0,0 +1,78 @@
+From 290ac0838ea42b3955ebe7f7d856969cc9d8dd59 Mon Sep 17 00:00:00 2001
+From: Martin Betak <mbetak at redhat.com>
+Date: Wed, 11 Sep 2013 17:26:21 +0200
+Subject: [PATCH] agent: Fix python-2.4 compatibility
+
+Rewrote the use of ternary operator to if since it is not
+supported in python-2.4.
+
+Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1006861
+Change-Id: I03c63477a2d2bcb9eb4c4307946a3486300663e1
+Signed-off-by: Martin Betak <mbetak at redhat.com>
+---
+ ovirt-guest-agent/GuestAgentLinux2.py | 7 +++++--
+ ovirt-guest-agent/GuestAgentWin32.py | 8 ++++++--
+ ovirt-guest-agent/OVirtAgentLogic.py | 4 +++-
+ 3 files changed, 14 insertions(+), 5 deletions(-)
+
+diff --git a/ovirt-guest-agent/GuestAgentLinux2.py b/ovirt-guest-agent/GuestAgentLinux2.py
+index abf0c3b..a60e7a5 100644
+--- a/ovirt-guest-agent/GuestAgentLinux2.py
++++ b/ovirt-guest-agent/GuestAgentLinux2.py
+@@ -167,11 +167,14 @@ class CommandHandlerLinux:
+ # The shutdown command works with minutes while vdsm send value in
+ # seconds, so we round up the value to minutes.
+ delay = (int(timeout) + 59) / 60
+- param = '-r' if reboot else '-h'
++ param = '-h'
++ action = 'shutdown'
++ if reboot:
++ param = '-r'
++ action = 'reboot'
+ cmd = ['/usr/share/ovirt-guest-agent/ovirt-shutdown', param,
+ "+%d" % (delay), "\"%s\"" % (msg)]
+
+- action = 'reboot' if reboot else 'shutdown'
+ logging.debug("Executing %s command: %s", action, cmd)
+ subprocess.call(cmd)
+
+diff --git a/ovirt-guest-agent/GuestAgentWin32.py b/ovirt-guest-agent/GuestAgentWin32.py
+index 28e391a..d66da4c 100644
+--- a/ovirt-guest-agent/GuestAgentWin32.py
++++ b/ovirt-guest-agent/GuestAgentWin32.py
+@@ -202,11 +202,15 @@ class CommandHandlerWin:
+ logging.debug("No active session. Ignoring log off command.")
+
+ def shutdown(self, timeout, msg, reboot=False):
+- param = '-r' if reboot else '-s'
++ param = '-s'
++ action = 'shutdown'
++ if reboot:
++ param = '-r'
++ action = 'reboot'
++
+ cmd = "%s\\system32\\shutdown.exe %s -t %d -f -c \"%s\"" \
+ % (os.environ['WINDIR'], param, timeout, msg)
+
+- action = 'reboot' if reboot else 'shutdown'
+ logging.debug("Executing %s command: '%s'", action, cmd)
+
+ # Since we're a 32-bit application that sometimes is executed on
+diff --git a/ovirt-guest-agent/OVirtAgentLogic.py b/ovirt-guest-agent/OVirtAgentLogic.py
+index 233e15b..52c3825 100644
+--- a/ovirt-guest-agent/OVirtAgentLogic.py
++++ b/ovirt-guest-agent/OVirtAgentLogic.py
+@@ -185,7 +185,9 @@ class AgentLogicBase:
+ except:
+ reboot = False
+
+- action = 'Rebooting' if reboot else 'Shutting down'
++ action = 'Shutting down'
++ if reboot:
++ action = 'Rebooting'
+ logging.info("%s (timeout = %d, message = '%s')"
+ % (action, timeout, msg))
+ self.commandHandler.shutdown(timeout, msg, reboot)
+--
+1.8.3.1
+
diff --git a/ovirt-guest-agent.spec b/ovirt-guest-agent.spec
index 8dd8596..a6ebfad 100644
--- a/ovirt-guest-agent.spec
+++ b/ovirt-guest-agent.spec
@@ -1,5 +1,5 @@
-%global release_version 4
+%global release_version 5
Name: ovirt-guest-agent
Version: 1.0.8
@@ -9,6 +9,8 @@ Group: Applications/System
License: ASL 2.0
URL: http://wiki.ovirt.org/wiki/Category:Ovirt_guest_agent
Source0: http://evilissimo.fedorapeople.org/releases/ovirt-guest-agent/%{version}/%{name}-%{version}.1.tar.bz2
+Patch1: 0001-agent-Fix-python-2.4-compatibility.patch
+
BuildArch: noarch
BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
BuildRequires: python2-devel
@@ -37,6 +39,8 @@ restart).
%prep
%setup -q -n ovirt-guest-agent-%{version}
+%patch1 -p1
+
%configure --without-sso
@@ -118,6 +122,9 @@ fi
%changelog
+* Mon Nov 25 2013 Vinzenz Feenstra <evilissimo at redhat.com> - 1.0.8-5
+ - Added python2.4 syntax fix
+
* Mon Nov 25 2013 Vinzenz Feenstra <evilissimo at redhat.com> - 1.0.8-4
- Removed selinux policy conflicts
More information about the scm-commits
mailing list