mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
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__:
*
|
||
---|---|---|
.. | ||
42647-win_updates.yaml | ||
42669-add_ssl_zabbix_inventory.yaml | ||
43024-nclu-empty-net-commands.yaml | ||
add_file_lock_feature.yaml | ||
add_random_mac_filtter.yaml | ||
admin-users-default-change.yaml | ||
ansiballz_one_interpreter.yml | ||
ansiballz_streamline_imports.yaml | ||
any_unparsed_is_failed.yaml | ||
avoid_cwd_vars.yml | ||
aws_core_is_boto3_error_code.yml | ||
aws_s3_async_fix.yaml | ||
aws_s3_decryption_fix.yaml | ||
aws_s3_fix_custom_endpoints.yaml | ||
basic_booleans_backward_compat.yaml | ||
batch_mode_elasticsearch_plugin.yaml | ||
callback_plugin_merge.yml | ||
clarify_error_message.yml | ||
cleanup__file__.yaml | ||
command_shell_check_mode.yaml | ||
connection_reset.yaml | ||
console_color.yml | ||
deprecated-__file__.yaml | ||
docker-default-ssl.yml | ||
elasticsearch_plugin-showSTDERRonFailure.yaml | ||
ensure_text_source.yaml | ||
file_attributes.yaml | ||
file_touch_check_mode.yaml | ||
file_touch_diff.yaml | ||
fix-255-exit-code.yaml | ||
fix-open-url.yml | ||
from_yaml_all_filter_plugin.yaml | ||
gce-sort-fix.yaml | ||
inventory_dir_ext_compare_fix.yaml | ||
irc_py3_compat.yaml | ||
lineinfile-empty-regexp.yml | ||
no_log_fix_for_connection_exceptions.yaml | ||
passwordstore-lookup-backup.yaml | ||
pause-stdout-redirection.yaml | ||
pause-try-except-curses.yaml | ||
preserve_delegate_nolog.yml | ||
puppet_debugging_options.yaml | ||
remote_tmp_de-escalated_user.yaml | ||
remove-unused-ansible-remote-temp.yaml | ||
syslog_facility-for-journald.yml | ||
template_output_encoding.yml | ||
user-freebsd-createhome-name-fix.yaml | ||
user_freebsd_always_changed_bugfix.yaml | ||
v2.7.0-initial-commit.yaml | ||
win_become_async_older_hosts.yml | ||
win_chocoalatey_install_tls12.yml | ||
win_chocolatey-bugfixes.yaml | ||
win_chocolatey-return-rc-always.yml | ||
win_domain-dns-typo-fix.yml | ||
win_iis_webapppool-output-fix.yml | ||
win_reboot-fixes.yml | ||
win_security_policy-empty-value.yaml | ||
win_updates-async-fix.yml | ||
win_user-validate-fixes.yaml | ||
winrm_kinit-remove-pass-log.yml | ||
wrcwd_ansible.cfg.yml |