Expand usage of Python 2.6 if statement

Syntax like "'foo' if bar else 'baz'" is not supported by all Python
versions targetted by Ansible. Hence we break it up.

Signed-off-by: martin f. krafft <madduck@madduck.net>
This commit is contained in:
martin f. krafft 2013-06-23 09:19:27 +02:00
parent 22b30b9281
commit 3b7b061b07

View file

@ -548,7 +548,10 @@ class LinuxService(Service):
return return
if self.enable_cmd.endswith("update-rc.d"): if self.enable_cmd.endswith("update-rc.d"):
action = 'enable' if self.enable else 'disable' if self.enable:
action = 'enable'
else:
action = 'disable'
(rc, out, err) = self.execute_command("%s -n %s %s" \ (rc, out, err) = self.execute_command("%s -n %s %s" \
% (self.enable_cmd, self.name, action)) % (self.enable_cmd, self.name, action))
self.changed = False self.changed = False