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
pull/4420/head
Brian Coca 2017-04-24 20:54:14 -04:00
parent cb13aea88b
commit 72a4e1cf0d
1 changed files with 127 additions and 126 deletions

View File

@ -294,7 +294,7 @@ def main():
}
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)
# Run daemon-reload first, if requested
@ -303,6 +303,7 @@ def main():
if rc != 0:
module.fail_json(msg='failure %d during daemon-reload: %s' % (rc, err))
if unit:
found = False
is_initd = sysv_exists(unit)
is_systemd = False