diff options
author | Toshio Kuratomi <toshio@fedoraproject.org> | 2016-04-05 23:48:37 -0700 |
---|---|---|
committer | Toshio Kuratomi <toshio@fedoraproject.org> | 2016-04-12 08:01:07 -0700 |
commit | dcc5dfdf811f24c3adbb879e77a1bf8789bf1738 (patch) | |
tree | 43f54efb4150cc9140cc843633136d55ad89dfbb /bin | |
parent | b5717ef696198ce11104885faaf5f86fe66a02cc (diff) | |
download | ansible-dcc5dfdf811f24c3adbb879e77a1bf8789bf1738.tar.gz |
Controller-side module caching.
This makes our recursive, ast.parse performance measures as fast as
pre-ziploader baseline.
Since this unittest isn't testing that the returned module data is
correct we don't need to worry about os.rename not having any module
data. Should devise a separate test for the module and caching code
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/ansible | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/bin/ansible b/bin/ansible index ccd6bb8e17..59b4fec305 100755 --- a/bin/ansible +++ b/bin/ansible @@ -33,6 +33,7 @@ except Exception: pass import os +import shutil import sys import traceback @@ -40,6 +41,7 @@ import traceback from multiprocessing import Lock debug_lock = Lock() +import ansible.constants as C from ansible.errors import AnsibleError, AnsibleOptionsError, AnsibleParserError from ansible.utils.display import Display from ansible.utils.unicode import to_unicode @@ -87,28 +89,28 @@ if __name__ == '__main__': cli = mycli(sys.argv) cli.parse() - sys.exit(cli.run()) + exit_code = cli.run() except AnsibleOptionsError as e: cli.parser.print_help() display.error(to_unicode(e), wrap_text=False) - sys.exit(5) + exit_code = 5 except AnsibleParserError as e: display.error(to_unicode(e), wrap_text=False) - sys.exit(4) + exit_code = 4 # TQM takes care of these, but leaving comment to reserve the exit codes # except AnsibleHostUnreachable as e: # display.error(str(e)) -# sys.exit(3) +# exit_code = 3 # except AnsibleHostFailed as e: # display.error(str(e)) -# sys.exit(2) +# exit_code = 2 except AnsibleError as e: display.error(to_unicode(e), wrap_text=False) - sys.exit(1) + exit_code = 1 except KeyboardInterrupt: display.error("User interrupted execution") - sys.exit(99) + exit_code = 99 except Exception as e: have_cli_options = cli is not None and cli.options is not None display.error("Unexpected Exception: %s" % to_unicode(e), wrap_text=False) @@ -116,4 +118,9 @@ if __name__ == '__main__': display.display(u"the full traceback was:\n\n%s" % to_unicode(traceback.format_exc())) else: display.display("to see the full traceback, use -vvv") - sys.exit(250) + exit_code = 250 + finally: + # Remove ansible tempdir + shutil.rmtree(C.DEFAULT_LOCAL_TMP, True) + + sys.exit(exit_code) |