fixes for service module interaction with systemd (#16720)

now systemd will run even if service module is inovked with parameters that it does not support
these will be removed before invoking systemd and issue a warning.

this facility will work for any new service modules.
pull/16806/head
Brian Coca 8 years ago committed by GitHub
parent 93c5ec42cf
commit 71c97685a1

@ -25,6 +25,10 @@ class ActionModule(ActionBase):
TRANSFERS_FILES = False
UNUSED_PARAMS = {
'systemd': ['pattern', 'runlevels', 'sleep', 'arguments'],
}
def run(self, tmp=None, task_vars=None):
''' handler for package operations '''
if task_vars is None:
@ -59,6 +63,12 @@ class ActionModule(ActionBase):
if 'state' in new_module_args and new_module_args['state'] == 'running':
new_module_args['state'] = 'started'
if module in self.UNUSED_PARAMS:
for unused in self.UNUSED_PARAMS[module]:
if unused in new_module_args:
del new_module_args[unused]
self._display.warning('Ignoring "%s" as it is not used in "%s"' % (unused, module))
self._display.vvvv("Running %s" % module)
result.update(self._execute_module(module_name=module, module_args=new_module_args, task_vars=task_vars))
else:

Loading…
Cancel
Save