mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-22 21:00:22 -07:00
Save the command line arguments into a global context
* Once cli args are parsed, they're constant. So, save the parsed args into the global context for everyone else to use them from now on. * Port cli scripts to use the CLIARGS in the context * Refactor call to parse cli args into the run() method * Fix unittests for changes to the internals of CLI arg parsing * Port callback plugins to use context.CLIARGS * Got rid of the private self._options attribute * Use context.CLIARGS in the individual callback plugins instead. * Also output positional arguments in default and unixy plugins * Code has been simplified since we're now dealing with a dict rather than Optparse.Value
This commit is contained in:
parent
c18da65089
commit
afdbb0d9d5
36 changed files with 1033 additions and 868 deletions
|
@ -32,6 +32,7 @@ from multiprocessing import Lock
|
|||
from jinja2.exceptions import UndefinedError
|
||||
|
||||
from ansible import constants as C
|
||||
from ansible import context
|
||||
from ansible.errors import AnsibleError, AnsibleFileNotFound, AnsibleParserError, AnsibleUndefinedVariable
|
||||
from ansible.executor import action_write_locks
|
||||
from ansible.executor.process.worker import WorkerProcess
|
||||
|
@ -170,9 +171,9 @@ class StrategyBase:
|
|||
self._variable_manager = tqm.get_variable_manager()
|
||||
self._loader = tqm.get_loader()
|
||||
self._final_q = tqm._final_q
|
||||
self._step = getattr(tqm._options, 'step', False)
|
||||
self._diff = getattr(tqm._options, 'diff', False)
|
||||
self.flush_cache = getattr(tqm._options, 'flush_cache', False)
|
||||
self._step = context.CLIARGS.get('step', False)
|
||||
self._diff = context.CLIARGS.get('diff', False)
|
||||
self.flush_cache = context.CLIARGS.get('flush_cache', False)
|
||||
|
||||
# the task cache is a dictionary of tuples of (host.name, task._uuid)
|
||||
# used to find the original task object of in-flight tasks and to store
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue