You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ansible/changelogs/fragments
Toshio Kuratomi 52449cc01a AnsiballZ improvements
Now that we don't need to worry about python-2.4 and 2.5, we can make
some improvements to the way AnsiballZ handles modules.

* Change AnsiballZ wrapper to use import to invoke the module
  We need the module to think of itself as a script because it could be
  coded as:

      main()

  or as:

      if __name__ == '__main__':
          main()

  Or even as:

      if __name__ == '__main__':
          random_function_name()

  A script will invoke all of those.  Prior to this change, we invoked
  a second Python interpreter on the module so that it really was
  a script.  However, this means that we have to run python twice (once
  for the AnsiballZ wrapper and once for the module).  This change makes
  the module think that it is a script (because __name__ in the module ==
  '__main__') but it's actually being invoked by us importing the module
  code.

  There's three ways we've come up to do this.
  * The most elegant is to use zipimporter and tell the import mechanism
    that the module being loaded is __main__:
    * 5959f11c9d/lib/ansible/executor/module_common.py (L175)
    * zipimporter is nice because we do not have to extract the module from
      the zip file and save it to the disk when we do that.  The import
      machinery does it all for us.
    * The drawback is that modules do not have a __file__ which points
      to a real file when they do this.  Modules could be using __file__
      to for a variety of reasons, most of those probably have
      replacements (the most common one is to find a writable directory
      for temporary files.  AnsibleModule.tmpdir should be used instead)
      We can monkeypatch __file__ in fom AnsibleModule initialization
      but that's kind of gross.  There's no way I can see to do this
      from the wrapper.

  * Next, there's imp.load_module():
    * https://github.com/abadger/ansible/blob/340edf7489/lib/ansible/executor/module_common.py#L151
    * imp has the nice property of allowing us to set __name__ to
      __main__ without changing the name of the file itself
    * We also don't have to do anything special to set __file__ for
      backwards compatibility (although the reason for that is the
      drawback):
    * Its drawback is that it requires the file to exist on disk so we
      have to explicitly extract it from the zipfile and save it to
      a temporary file

  * The last choice is to use exec to execute the module:
    * https://github.com/abadger/ansible/blob/f47a4ccc76/lib/ansible/executor/module_common.py#L175
    * The code we would have to maintain for this looks pretty clean.
      In the wrapper we create a ModuleType, set __file__ on it, read
      the module's contents in from the zip file and then exec it.
    * Drawbacks: We still have to explicitly extract the file's contents
      from the zip archive instead of letting python's import mechanism
      handle it.
    * Exec also has hidden performance issues and breaks certain
      assumptions that modules could be making about their own code:
      http://lucumr.pocoo.org/2011/2/1/exec-in-python/

  Our plan is to use imp.load_module() for now, deprecate the use of
  __file__ in modules, and switch to zipimport once the deprecation
  period for __file__ is over (without monkeypatching a fake __file__ in
  via AnsibleModule).

* Rename the name of the AnsiBallZ wrapped module
  This makes it obvious that the wrapped module isn't the module file that
  we distribute.  It's part of trying to mitigate the fact that the module
  is now named __main)).py in tracebacks.

* Shield all wrapper symbols inside of a function
  With the new import code, all symbols in the wrapper become visible in
  the module.  To mitigate the chance of collisions, move most symbols
  into a toplevel function.  The only symbols left in the global namespace
  are now _ANSIBALLZ_WRAPPER and _ansiballz_main.

revised porting guide entry

Integrate code coverage collection into AnsiballZ.

ci_coverage
ci_complete
6 years ago
..
42647-win_updates.yaml return wu result from inner job (#42647) 6 years ago
42669-add_ssl_zabbix_inventory.yaml Zabbix inventory improvement (#42669) 6 years ago
43024-nclu-empty-net-commands.yaml NCLU Module: Improve performance by not operating on empty lines (#43024) 6 years ago
add_file_lock_feature.yaml Simple file locking feature (#42024) 6 years ago
add_random_mac_filtter.yaml Add random_mac string filter (#39775) 6 years ago
admin-users-default-change.yaml Make admin_users only contain root and toor because admin is used for non-privileged accounts 7 years ago
ansiballz_one_interpreter.yml AnsiballZ improvements 6 years ago
ansiballz_streamline_imports.yaml Remove an unnecessary import from the ansiballz wrapper (#41747) 6 years ago
any_unparsed_is_failed.yaml Introduce inventory.any_unparsed_is_failed configuration setting (#41171) 7 years ago
avoid_cwd_vars.yml avoid loading vars on unspecified basedir (cwd) (#42067) 6 years ago
aws_core_is_boto3_error_code.yml Add AWS boto3 error code exception function is_boto3_error_code (#41202) 7 years ago
aws_s3_async_fix.yaml Fix async for aws_s3 - fixes #40281 (#40826) 7 years ago
aws_s3_decryption_fix.yaml aws_s3: don't decrypt file before uploading - fixes #39287 (#39634) 7 years ago
aws_s3_fix_custom_endpoints.yaml [aws] Remove walrus conditional in aws_s3 module when using custom s3_url (#36832) 7 years ago
basic_booleans_backward_compat.yaml Restore BOOLEANS import in basic.py (#42008) 6 years ago
batch_mode_elasticsearch_plugin.yaml Add the possiblity to force a plugin installation (#41688) 6 years ago
callback_plugin_merge.yml Merge various stdout callback plugins into 'default' (#41058) 6 years ago
clarify_error_message.yml better error messasge (#42770) 6 years ago
cleanup__file__.yaml Port modules away from __file__ 6 years ago
command_shell_check_mode.yaml Enable check_mode in command module (#40428) 6 years ago
connection_reset.yaml changed winrm _reset to reset and make ssh reset show warning (#42651) 6 years ago
console_color.yml Allow to specifically customize console's color 6 years ago
deprecated-__file__.yaml AnsiballZ improvements 6 years ago
docker-default-ssl.yml Fix ssl_version default value. (#42955) 6 years ago
elasticsearch_plugin-showSTDERRonFailure.yaml elasticsearch_plugin - Show STDERR on module failures. (#41954) 6 years ago
ensure_text_source.yaml ensure 'text' source assumptions (#42522) 6 years ago
file_attributes.yaml Remove extra line in file_attributes.yaml 7 years ago
file_touch_check_mode.yaml Fix file module with check_mode - Fixes #42111 (#42115) 6 years ago
file_touch_diff.yaml Fix file state=touch not returning diff information 6 years ago
fix-255-exit-code.yaml Separate some 255 exit codes that are not ssh errors 6 years ago
fix-open-url.yml Only assume GET if no data, otherwise POST (#43133) 6 years ago
from_yaml_all_filter_plugin.yaml Add from_yaml_all to support multi document yaml strings (#43037) 6 years ago
gce-sort-fix.yaml Add changelog for gce_net sort fix 7 years ago
inventory_dir_ext_compare_fix.yaml Make sure we are comparing bytes extensions in inventory plugins (#42475) 6 years ago
irc_py3_compat.yaml fix irc module to work with py3 (#42267) 6 years ago
lineinfile-empty-regexp.yml Add warning when using an empty regexp in lineinfile (#42013) 6 years ago
no_log_fix_for_connection_exceptions.yaml Add changelog entry for the no_log fix 7 years ago
passwordstore-lookup-backup.yaml Add backup option to passwordstore lookup (and improve doc) (#39676) 7 years ago
pause-stdout-redirection.yaml Fix pause module so it does not stack trace when redirecting stdout. (#42217) 6 years ago
pause-try-except-curses.yaml Fix NameError in pause module (#42038) 6 years ago
preserve_delegate_nolog.yml preserve delegation info on no_log (#42577) 6 years ago
puppet_debugging_options.yaml Add additional puppet options (#42218) 6 years ago
remote_tmp_de-escalated_user.yaml Fix remote_tmp when become with non admin user (#42396) 6 years ago
remove-unused-ansible-remote-temp.yaml ANSIBLE_REMOTE_TMP was an implementation of unified temp that was later changed 6 years ago
syslog_facility-for-journald.yml Add syslog_facility parameter handling with systemd.journal (#41078) 7 years ago
template_output_encoding.yml Allow specifying the output encoding in the template module (#42171) 6 years ago
user-freebsd-createhome-name-fix.yaml fix a (forgotten?) change in moving createhome -> create_home (#42711) 6 years ago
user_freebsd_always_changed_bugfix.yaml Only report change when home directory is different on FreeBSD (#42865) 6 years ago
v2.7.0-initial-commit.yaml Initial commit for 2.7.0 development. 7 years ago
win_become_async_older_hosts.yml runas + async - get working on older hosts (#41772) 6 years ago
win_chocoalatey_install_tls12.yml win_chocolatey: add TLSv1.2 support for install phase (#41992) 6 years ago
win_chocolatey-bugfixes.yaml win_chocolatey: refactor module to fix bugs and add new features (#43013) 6 years ago
win_chocolatey-return-rc-always.yml win_chocolatey: always return the rc return value (#41883) 6 years ago
win_domain-dns-typo-fix.yml win_domain: fix typo in cmdlet call (#41993) 6 years ago
win_iis_webapppool-output-fix.yml win_iis_webapppool: do not output some cmdlet outputs (#41884) 6 years ago
win_reboot-fixes.yml win_reboot: fix 2.6 issues and better handle post reboot reboot (#42330) 6 years ago
win_security_policy-empty-value.yaml win_security_policy: Allow setting a value to empty (#42051) 6 years ago
win_updates-async-fix.yml win_updates fix when win_updates is run with async (#41756) 6 years ago
win_user-validate-fixes.yaml win_user: use different method to validate credentials that does not rely on SMB/RPC (#43059) 6 years ago
winrm_kinit-remove-pass-log.yml Stop displaying kinit pass input on a failure (#41882) 6 years ago
wrcwd_ansible.cfg.yml fix changelog (#42272) 6 years ago