systemd - use list-unit-files rather than list-units (#72363)
list-unit-files will return all files on the system. list-units omits those that are disabled. Co-authored-by: Ken Dreyer <ktdreyer@ktdreyer.com>
This commit is contained in:
parent
7352457e7b
commit
d6115887fa
2 changed files with 6 additions and 1 deletions
5
changelogs/fragments/71528-systemd-list-unit-files.yml
Normal file
5
changelogs/fragments/71528-systemd-list-unit-files.yml
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
bugfixes:
|
||||||
|
- >
|
||||||
|
systemd - follow up fix to https://github.com/ansible/ansible/issues/72338
|
||||||
|
to use ``list-unit-files`` rather than ``list-units`` in order to show
|
||||||
|
all units files on the system.
|
|
@ -405,7 +405,7 @@ def main():
|
||||||
elif err and rc == 1 and 'Failed to parse bus message' in err:
|
elif err and rc == 1 and 'Failed to parse bus message' in err:
|
||||||
result['status'] = parse_systemctl_show(to_native(out).split('\n'))
|
result['status'] = parse_systemctl_show(to_native(out).split('\n'))
|
||||||
|
|
||||||
(rc, out, err) = module.run_command("{systemctl} list-units '{unit}*'".format(systemctl=systemctl, unit=unit))
|
(rc, out, err) = module.run_command("{systemctl} list-unit-files '{unit}*'".format(systemctl=systemctl, unit=unit))
|
||||||
is_systemd = unit in out
|
is_systemd = unit in out
|
||||||
|
|
||||||
(rc, out, err) = module.run_command("{systemctl} is-active '{unit}'".format(systemctl=systemctl, unit=unit))
|
(rc, out, err) = module.run_command("{systemctl} is-active '{unit}'".format(systemctl=systemctl, unit=unit))
|
||||||
|
|
Loading…
Reference in a new issue