From 886fed5ae79f3675014868b17c6d3fdcbc597fc7 Mon Sep 17 00:00:00 2001 From: Florian Diebold Date: Sun, 26 Aug 2012 00:16:58 +0200 Subject: [PATCH] Remove ternary operator to fix python 2.4 compatibility. --- library/service | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/library/service b/library/service index 232861f0c32..e884f902ed5 100755 --- a/library/service +++ b/library/service @@ -145,12 +145,19 @@ def _do_enable(name, enable): # update-rc.d wants enable/disable while # chkconfig wants on/off # also, systemctl needs the arguments reversed + if enable: + on_off = "on" + enable_disable = "enable" + else: + on_off = "off" + enable_disable = "disable" + if CHKCONFIG.endswith("update-rc.d"): - args = (CHKCONFIG, name, "enable" if enable else "disable") + args = (CHKCONFIG, name, enable_disable) elif CHKCONFIG.endswith("systemctl"): - args = (CHKCONFIG, "enable" if enable else "disable", name + ".service") + args = (CHKCONFIG, enable_disable, name + ".service") else: - args = (CHKCONFIG, name, "on" if enable else "off") + args = (CHKCONFIG, name, on_off) if enable is not None: rc, stdout, stderr = _run("%s %s %s" % args)