diff options
author | Toshio Kuratomi <a.badger@gmail.com> | 2018-12-17 18:10:59 -0800 |
---|---|---|
committer | Toshio Kuratomi <a.badger@gmail.com> | 2019-01-03 18:12:23 -0800 |
commit | afdbb0d9d5bebb91f632f0d4a1364de5393ba17a (patch) | |
tree | 4f688eed3ef5ea1ccd3f80dc716dc62ba7958f3f /bin | |
parent | c18da65089e396ac2e459654398b32f68aecfc98 (diff) | |
download | ansible-afdbb0d9d5bebb91f632f0d4a1364de5393ba17a.zip |
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
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/ansible | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/bin/ansible b/bin/ansible index cd83e9a413..6a5568dff5 100755 --- a/bin/ansible +++ b/bin/ansible @@ -29,6 +29,7 @@ import shutil import sys import traceback +from ansible import context from ansible.errors import AnsibleError, AnsibleOptionsError, AnsibleParserError from ansible.module_utils._text import to_text @@ -106,7 +107,6 @@ if __name__ == '__main__': exit_code = 6 else: cli = mycli(args) - cli.parse() exit_code = cli.run() except AnsibleOptionsError as e: @@ -134,9 +134,9 @@ if __name__ == '__main__': # Show raw stacktraces in debug mode, It also allow pdb to # enter post mortem mode. raise - have_cli_options = cli is not None and cli.options is not None + have_cli_options = bool(context.CLIARGS) display.error("Unexpected Exception, this is probably a bug: %s" % to_text(e), wrap_text=False) - if not have_cli_options or have_cli_options and cli.options.verbosity > 2: + if not have_cli_options or have_cli_options and context.CLIARGS['verbosity'] > 2: log_only = False if hasattr(e, 'orig_exc'): display.vvv('\nexception type: %s' % to_text(type(e.orig_exc))) |