From b12f80712b0c9a8944323b89440a049b14611c7b Mon Sep 17 00:00:00 2001 From: Daniel Wallace Date: Sat, 19 May 2018 21:14:40 -0500 Subject: [PATCH] add more documentation for new function --- doc/ref/executors/all/index.rst | 1 + doc/ref/executors/all/salt.executors.docker.rst | 6 ++++++ doc/ref/executors/index.rst | 4 ++++ salt/executors/docker.py | 8 +++++++- salt/minion.py | 4 ++-- 5 files changed, 20 insertions(+), 3 deletions(-) create mode 100644 doc/ref/executors/all/salt.executors.docker.rst diff --git a/doc/ref/executors/all/index.rst b/doc/ref/executors/all/index.rst index fd846f3714..1f26a86fc3 100644 --- a/doc/ref/executors/all/index.rst +++ b/doc/ref/executors/all/index.rst @@ -11,5 +11,6 @@ executors modules :template: autosummary.rst.tmpl direct_call + docker splay sudo diff --git a/doc/ref/executors/all/salt.executors.docker.rst b/doc/ref/executors/all/salt.executors.docker.rst new file mode 100644 index 0000000000..9f2b3cb246 --- /dev/null +++ b/doc/ref/executors/all/salt.executors.docker.rst @@ -0,0 +1,6 @@ +salt.executors.docker module +============================ + +.. automodule:: salt.executors.docker + :members: + diff --git a/doc/ref/executors/index.rst b/doc/ref/executors/index.rst index f7a0e33a84..5a529c3977 100644 --- a/doc/ref/executors/index.rst +++ b/doc/ref/executors/index.rst @@ -83,3 +83,7 @@ option set by commandline or API ``data.get('executor_opts', {}).get('splaytime')`` should be used. So if an option is safe and must be accessible by user executor should check it in both places, but if an option is unsafe it should be read from the only config ignoring the passed request data. + +There is also a function named ``all_missing_func`` which the name of the +``func`` is passed, which can be used to verify if the command should still be +run, even if it is not loaded in minion_mods. diff --git a/salt/executors/docker.py b/salt/executors/docker.py index 713b18f777..14080998cd 100644 --- a/salt/executors/docker.py +++ b/salt/executors/docker.py @@ -36,5 +36,11 @@ def execute(opts, data, func, args, kwargs): return __salt__['docker.call'](opts['proxy']['name'], data['fun'], *args, **kwargs) -def allow_missing_funcs(): +def allow_missing_func(function): # pylint: disable=unused-argument + ''' + Allow all calls to be passed through to docker container. + + The docker call will use direct_call, which will return back if the module + was unable to be run. + ''' return True diff --git a/salt/minion.py b/salt/minion.py index 8456138f80..b01db2122b 100644 --- a/salt/minion.py +++ b/salt/minion.py @@ -1569,9 +1569,9 @@ class Minion(MinionBase): getattr(minion_instance, 'module_executors', []) or \ opts.get('module_executors', ['direct_call']) allow_missing_funcs = any([ - minion_instance.executors['{0}.allow_missing_funcs'.format(executor)]() + minion_instance.executors['{0}.allow_missing_func'.format(executor)](function_name) for executor in executors - if '{0}.allow_missing_funcs' in minion_instance.executors + if '{0}.allow_missing_func' in minion_instance.executors ]) if function_name in minion_instance.functions or allow_missing_funcs is True: try: