Remove ternary operator to fix python 2.4 compatibility.
This commit is contained in:
parent
af17bab373
commit
886fed5ae7
1 changed files with 12 additions and 5 deletions
|
@ -145,12 +145,19 @@ def _do_enable(name, enable):
|
||||||
# update-rc.d wants enable/disable while
|
# update-rc.d wants enable/disable while
|
||||||
# chkconfig wants on/off
|
# chkconfig wants on/off
|
||||||
# also, systemctl needs the arguments reversed
|
# also, systemctl needs the arguments reversed
|
||||||
if CHKCONFIG.endswith("update-rc.d"):
|
if enable:
|
||||||
args = (CHKCONFIG, name, "enable" if enable else "disable")
|
on_off = "on"
|
||||||
elif CHKCONFIG.endswith("systemctl"):
|
enable_disable = "enable"
|
||||||
args = (CHKCONFIG, "enable" if enable else "disable", name + ".service")
|
|
||||||
else:
|
else:
|
||||||
args = (CHKCONFIG, name, "on" if enable else "off")
|
on_off = "off"
|
||||||
|
enable_disable = "disable"
|
||||||
|
|
||||||
|
if CHKCONFIG.endswith("update-rc.d"):
|
||||||
|
args = (CHKCONFIG, name, enable_disable)
|
||||||
|
elif CHKCONFIG.endswith("systemctl"):
|
||||||
|
args = (CHKCONFIG, enable_disable, name + ".service")
|
||||||
|
else:
|
||||||
|
args = (CHKCONFIG, name, on_off)
|
||||||
|
|
||||||
if enable is not None:
|
if enable is not None:
|
||||||
rc, stdout, stderr = _run("%s %s %s" % args)
|
rc, stdout, stderr = _run("%s %s %s" % args)
|
||||||
|
|
Loading…
Reference in a new issue