systemd: return an error when systemctl command isn't available
This commit is contained in:
parent
703d6cb02f
commit
fb8aa5637a
1 changed files with 3 additions and 0 deletions
|
@ -334,6 +334,9 @@ def main():
|
||||||
# Check for loading error
|
# Check for loading error
|
||||||
if is_systemd and 'LoadError' in result['status']:
|
if is_systemd and 'LoadError' in result['status']:
|
||||||
module.fail_json(msg="Error loading unit file '%s': %s" % (unit, result['status']['LoadError']))
|
module.fail_json(msg="Error loading unit file '%s': %s" % (unit, result['status']['LoadError']))
|
||||||
|
else:
|
||||||
|
# Check for systemctl command
|
||||||
|
module.run_command(systemctl, check_rc=True)
|
||||||
|
|
||||||
# Does service exist?
|
# Does service exist?
|
||||||
found = is_systemd or is_initd
|
found = is_systemd or is_initd
|
||||||
|
|
Loading…
Reference in a new issue