1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

fixed code to actually check the parameter not key

also made rest conditional on unit being provided, previouslly it changed from being always required

fixes #23810 alternate to #23907
This commit is contained in:
Brian Coca 2017-04-24 20:54:14 -04:00
parent cb13aea88b
commit 72a4e1cf0d

View file

@ -294,7 +294,7 @@ def main():
} }
for requires in ('state', 'enabled', 'masked'): for requires in ('state', 'enabled', 'masked'):
if requires is not None and unit is None: if module.params[requires] is not None and unit is None:
module.fail_json(msg="name is also required when specifying %s" % requires) module.fail_json(msg="name is also required when specifying %s" % requires)
# Run daemon-reload first, if requested # Run daemon-reload first, if requested
@ -303,6 +303,7 @@ def main():
if rc != 0: if rc != 0:
module.fail_json(msg='failure %d during daemon-reload: %s' % (rc, err)) module.fail_json(msg='failure %d during daemon-reload: %s' % (rc, err))
if unit:
found = False found = False
is_initd = sysv_exists(unit) is_initd = sysv_exists(unit)
is_systemd = False is_systemd = False