summaryrefslogtreecommitdiff
path: root/system/systemd.py
diff options
context:
space:
mode:
authorjctanner <tanner.jc@gmail.com>2016-11-28 14:15:12 -0500
committerGitHub <noreply@github.com>2016-11-28 14:15:12 -0500
commit84926c1c9d7a9cdb5b4a7d84b36b4d96470d6867 (patch)
treebafb17a2344ccb7f10930d26be4d517b1945015e /system/systemd.py
parente1e64c5aef636aaa4e5e697d02cfcbefef4365b8 (diff)
downloadansible-modules-core-84926c1c9d7a9cdb5b4a7d84b36b4d96470d6867.tar.gz
Use the the new features of fail_if_missing for checkmode (#5750)
Diffstat (limited to 'system/systemd.py')
-rw-r--r--system/systemd.py7
1 files changed, 3 insertions, 4 deletions
diff --git a/system/systemd.py b/system/systemd.py
index d835b85f..19fedce4 100644
--- a/system/systemd.py
+++ b/system/systemd.py
@@ -329,8 +329,7 @@ def main():
(rc, out, err) = module.run_command("%s %s '%s'" % (systemctl, action, unit))
if rc != 0:
# some versions of system CAN mask/unmask non existing services, we only fail on missing if they don't
- fail_if_missing(module, found, unit, "cannot %s" % (action))
- module.fail_json(msg="Unable to %s service %s: %s" % (action, unit, err))
+ fail_if_missing(module, found, unit, msg='host')
# Enable/disable service startup at boot if requested
@@ -341,7 +340,7 @@ def main():
else:
action = 'disable'
- fail_if_missing(module, found, unit, "cannot %s" % (action))
+ fail_if_missing(module, found, unit, msg='host')
# do we need to enable the service?
enabled = False
@@ -370,7 +369,7 @@ def main():
# set service state if requested
if module.params['state'] is not None:
- fail_if_missing(module, found, unit, "cannot check nor set state")
+ fail_if_missing(module, found, unit, msg="host")
# default to desired state
result['state'] = module.params['state']