ansible-core 2.16.6__py3-none-any.whl → 2.17.0rc1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of ansible-core might be problematic. Click here for more details.
- ansible/__init__.py +1 -3
- ansible/__main__.py +1 -0
- ansible/_vendor/__init__.py +1 -2
- ansible/cli/__init__.py +7 -8
- ansible/cli/adhoc.py +1 -2
- ansible/cli/arguments/__init__.py +1 -2
- ansible/cli/arguments/option_helpers.py +1 -2
- ansible/cli/config.py +1 -2
- ansible/cli/console.py +1 -2
- ansible/cli/doc.py +320 -198
- ansible/cli/galaxy.py +9 -3
- ansible/cli/inventory.py +4 -6
- ansible/cli/playbook.py +1 -2
- ansible/cli/pull.py +4 -5
- ansible/cli/scripts/ansible_connection_cli_stub.py +1 -4
- ansible/cli/vault.py +1 -2
- ansible/collections/list.py +1 -0
- ansible/compat/__init__.py +1 -4
- ansible/compat/importlib_resources.py +1 -2
- ansible/compat/{selectors/__init__.py → selectors.py} +12 -12
- ansible/config/ansible_builtin_runtime.yml +2 -0
- ansible/config/base.yml +154 -149
- ansible/config/manager.py +33 -25
- ansible/constants.py +1 -2
- ansible/context.py +1 -4
- ansible/errors/__init__.py +1 -3
- ansible/errors/yaml_strings.py +1 -3
- ansible/executor/__init__.py +1 -3
- ansible/executor/discovery/python_target.py +1 -2
- ansible/executor/interpreter_discovery.py +9 -8
- ansible/executor/module_common.py +1 -3
- ansible/executor/play_iterator.py +2 -4
- ansible/executor/playbook_executor.py +1 -3
- ansible/executor/powershell/module_manifest.py +2 -3
- ansible/executor/process/__init__.py +1 -3
- ansible/executor/process/worker.py +1 -3
- ansible/executor/stats.py +1 -3
- ansible/executor/task_executor.py +2 -3
- ansible/executor/task_queue_manager.py +1 -3
- ansible/executor/task_result.py +2 -3
- ansible/galaxy/__init__.py +1 -2
- ansible/galaxy/api.py +10 -2
- ansible/galaxy/collection/__init__.py +38 -24
- ansible/galaxy/collection/concrete_artifact_manager.py +1 -2
- ansible/galaxy/collection/galaxy_api_proxy.py +1 -2
- ansible/galaxy/collection/gpg.py +4 -2
- ansible/galaxy/data/apb/meta/main.yml.j2 +0 -15
- ansible/galaxy/data/container/meta/main.yml.j2 +0 -18
- ansible/galaxy/data/default/role/meta/main.yml.j2 +0 -18
- ansible/galaxy/data/network/cliconf_plugins/example.py.j2 +1 -2
- ansible/galaxy/data/network/library/example_command.py.j2 +1 -2
- ansible/galaxy/data/network/library/example_config.py.j2 +1 -2
- ansible/galaxy/data/network/library/example_facts.py.j2 +1 -2
- ansible/galaxy/data/network/meta/main.yml.j2 +0 -15
- ansible/galaxy/data/network/module_utils/example.py.j2 +1 -2
- ansible/galaxy/data/network/netconf_plugins/example.py.j2 +1 -2
- ansible/galaxy/data/network/terminal_plugins/example.py.j2 +1 -2
- ansible/galaxy/dependency_resolution/__init__.py +1 -2
- ansible/galaxy/dependency_resolution/dataclasses.py +5 -6
- ansible/galaxy/dependency_resolution/errors.py +1 -2
- ansible/galaxy/dependency_resolution/providers.py +3 -4
- ansible/galaxy/dependency_resolution/reporters.py +2 -3
- ansible/galaxy/dependency_resolution/resolvers.py +1 -2
- ansible/galaxy/dependency_resolution/versioning.py +1 -2
- ansible/galaxy/role.py +12 -15
- ansible/galaxy/token.py +1 -2
- ansible/galaxy/user_agent.py +1 -2
- ansible/inventory/data.py +1 -2
- ansible/inventory/group.py +1 -2
- ansible/inventory/helpers.py +1 -2
- ansible/inventory/host.py +1 -3
- ansible/inventory/manager.py +1 -2
- ansible/module_utils/_text.py +1 -2
- ansible/module_utils/ansible_release.py +3 -5
- ansible/module_utils/api.py +1 -2
- ansible/module_utils/basic.py +113 -158
- ansible/module_utils/common/_collections_compat.py +1 -2
- ansible/module_utils/common/_utils.py +1 -3
- ansible/module_utils/common/arg_spec.py +1 -2
- ansible/module_utils/common/collections.py +1 -2
- ansible/module_utils/common/dict_transformations.py +1 -2
- ansible/module_utils/common/file.py +10 -5
- ansible/module_utils/common/json.py +1 -3
- ansible/module_utils/common/locale.py +1 -2
- ansible/module_utils/common/network.py +2 -3
- ansible/module_utils/common/parameters.py +9 -9
- ansible/module_utils/common/process.py +12 -5
- ansible/module_utils/common/respawn.py +2 -3
- ansible/module_utils/common/sys_info.py +1 -2
- ansible/module_utils/common/text/converters.py +1 -2
- ansible/module_utils/common/text/formatters.py +1 -2
- ansible/module_utils/common/validation.py +5 -6
- ansible/module_utils/common/warnings.py +1 -2
- ansible/module_utils/common/yaml.py +1 -2
- ansible/module_utils/compat/datetime.py +1 -3
- ansible/module_utils/compat/importlib.py +21 -13
- ansible/module_utils/compat/paramiko.py +1 -2
- ansible/module_utils/compat/selectors.py +10 -34
- ansible/module_utils/compat/selinux.py +1 -2
- ansible/module_utils/compat/typing.py +1 -2
- ansible/module_utils/compat/version.py +1 -2
- ansible/module_utils/connection.py +1 -2
- ansible/module_utils/csharp/Ansible.Basic.cs +20 -3
- ansible/module_utils/distro/__init__.py +3 -4
- ansible/module_utils/distro/_distro.py +230 -234
- ansible/module_utils/errors.py +1 -2
- ansible/module_utils/facts/__init__.py +1 -2
- ansible/module_utils/facts/ansible_collector.py +1 -2
- ansible/module_utils/facts/collector.py +1 -2
- ansible/module_utils/facts/compat.py +1 -2
- ansible/module_utils/facts/default_collectors.py +1 -2
- ansible/module_utils/facts/hardware/aix.py +1 -2
- ansible/module_utils/facts/hardware/base.py +1 -2
- ansible/module_utils/facts/hardware/darwin.py +1 -2
- ansible/module_utils/facts/hardware/dragonfly.py +1 -2
- ansible/module_utils/facts/hardware/freebsd.py +1 -2
- ansible/module_utils/facts/hardware/hpux.py +1 -2
- ansible/module_utils/facts/hardware/hurd.py +1 -2
- ansible/module_utils/facts/hardware/linux.py +8 -6
- ansible/module_utils/facts/hardware/netbsd.py +1 -2
- ansible/module_utils/facts/hardware/openbsd.py +1 -2
- ansible/module_utils/facts/hardware/sunos.py +2 -3
- ansible/module_utils/facts/namespace.py +1 -2
- ansible/module_utils/facts/network/aix.py +1 -2
- ansible/module_utils/facts/network/base.py +1 -2
- ansible/module_utils/facts/network/darwin.py +1 -2
- ansible/module_utils/facts/network/dragonfly.py +1 -2
- ansible/module_utils/facts/network/fc_wwn.py +1 -2
- ansible/module_utils/facts/network/freebsd.py +1 -2
- ansible/module_utils/facts/network/generic_bsd.py +1 -2
- ansible/module_utils/facts/network/hpux.py +1 -2
- ansible/module_utils/facts/network/hurd.py +1 -2
- ansible/module_utils/facts/network/iscsi.py +1 -2
- ansible/module_utils/facts/network/linux.py +1 -2
- ansible/module_utils/facts/network/netbsd.py +1 -2
- ansible/module_utils/facts/network/nvme.py +1 -2
- ansible/module_utils/facts/network/openbsd.py +1 -2
- ansible/module_utils/facts/network/sunos.py +1 -2
- ansible/module_utils/facts/other/facter.py +1 -2
- ansible/module_utils/facts/other/ohai.py +1 -2
- ansible/module_utils/facts/packages.py +1 -2
- ansible/module_utils/facts/sysctl.py +1 -2
- ansible/module_utils/facts/system/apparmor.py +1 -2
- ansible/module_utils/facts/system/caps.py +1 -2
- ansible/module_utils/facts/system/chroot.py +1 -2
- ansible/module_utils/facts/system/cmdline.py +1 -2
- ansible/module_utils/facts/system/date_time.py +1 -2
- ansible/module_utils/facts/system/distribution.py +4 -5
- ansible/module_utils/facts/system/dns.py +1 -2
- ansible/module_utils/facts/system/env.py +1 -2
- ansible/module_utils/facts/system/fips.py +1 -2
- ansible/module_utils/facts/system/loadavg.py +1 -2
- ansible/module_utils/facts/system/local.py +1 -2
- ansible/module_utils/facts/system/lsb.py +1 -2
- ansible/module_utils/facts/system/pkg_mgr.py +7 -30
- ansible/module_utils/facts/system/platform.py +1 -2
- ansible/module_utils/facts/system/python.py +1 -2
- ansible/module_utils/facts/system/selinux.py +1 -2
- ansible/module_utils/facts/system/service_mgr.py +1 -2
- ansible/module_utils/facts/system/ssh_pub_keys.py +1 -2
- ansible/module_utils/facts/system/user.py +1 -2
- ansible/module_utils/facts/timeout.py +1 -2
- ansible/module_utils/facts/utils.py +1 -2
- ansible/module_utils/facts/virtual/base.py +1 -2
- ansible/module_utils/facts/virtual/dragonfly.py +1 -2
- ansible/module_utils/facts/virtual/freebsd.py +1 -2
- ansible/module_utils/facts/virtual/hpux.py +1 -2
- ansible/module_utils/facts/virtual/linux.py +1 -2
- ansible/module_utils/facts/virtual/netbsd.py +1 -2
- ansible/module_utils/facts/virtual/openbsd.py +1 -2
- ansible/module_utils/facts/virtual/sunos.py +1 -2
- ansible/module_utils/facts/virtual/sysctl.py +1 -2
- ansible/module_utils/json_utils.py +1 -2
- ansible/module_utils/parsing/convert_bool.py +1 -2
- ansible/module_utils/powershell/Ansible.ModuleUtils.Legacy.psm1 +5 -2
- ansible/module_utils/powershell/Ansible.ModuleUtils.WebRequest.psm1 +1 -1
- ansible/module_utils/pycompat24.py +24 -4
- ansible/module_utils/service.py +31 -5
- ansible/module_utils/six/__init__.py +1 -1
- ansible/module_utils/splitter.py +1 -2
- ansible/module_utils/urls.py +335 -1052
- ansible/module_utils/yumdnf.py +13 -35
- ansible/modules/add_host.py +1 -2
- ansible/modules/apt.py +38 -22
- ansible/modules/apt_key.py +1 -2
- ansible/modules/apt_repository.py +18 -10
- ansible/modules/assemble.py +1 -2
- ansible/modules/assert.py +8 -4
- ansible/modules/async_status.py +17 -14
- ansible/modules/async_wrapper.py +11 -9
- ansible/modules/blockinfile.py +2 -3
- ansible/modules/command.py +1 -2
- ansible/modules/copy.py +4 -76
- ansible/modules/cron.py +3 -3
- ansible/modules/deb822_repository.py +5 -5
- ansible/modules/debconf.py +19 -8
- ansible/modules/debug.py +1 -2
- ansible/modules/dnf.py +59 -186
- ansible/modules/dnf5.py +57 -43
- ansible/modules/dpkg_selections.py +1 -2
- ansible/modules/expect.py +23 -15
- ansible/modules/fail.py +1 -2
- ansible/modules/fetch.py +1 -2
- ansible/modules/file.py +4 -3
- ansible/modules/find.py +18 -5
- ansible/modules/gather_facts.py +1 -2
- ansible/modules/get_url.py +2 -3
- ansible/modules/getent.py +2 -3
- ansible/modules/git.py +28 -17
- ansible/modules/group.py +1 -2
- ansible/modules/group_by.py +1 -2
- ansible/modules/hostname.py +2 -19
- ansible/modules/import_playbook.py +1 -2
- ansible/modules/import_role.py +9 -2
- ansible/modules/import_tasks.py +1 -2
- ansible/modules/include_role.py +1 -2
- ansible/modules/include_tasks.py +1 -2
- ansible/modules/include_vars.py +1 -2
- ansible/modules/iptables.py +38 -21
- ansible/modules/known_hosts.py +15 -8
- ansible/modules/lineinfile.py +1 -6
- ansible/modules/meta.py +3 -2
- ansible/modules/package.py +6 -5
- ansible/modules/package_facts.py +1 -2
- ansible/modules/pause.py +2 -3
- ansible/modules/ping.py +1 -2
- ansible/modules/pip.py +40 -20
- ansible/modules/raw.py +1 -2
- ansible/modules/reboot.py +1 -2
- ansible/modules/replace.py +7 -5
- ansible/modules/rpm_key.py +1 -2
- ansible/modules/script.py +1 -2
- ansible/modules/service.py +3 -21
- ansible/modules/service_facts.py +3 -12
- ansible/modules/set_fact.py +1 -2
- ansible/modules/set_stats.py +1 -2
- ansible/modules/setup.py +1 -2
- ansible/modules/shell.py +1 -2
- ansible/modules/slurp.py +1 -2
- ansible/modules/stat.py +1 -2
- ansible/modules/subversion.py +2 -3
- ansible/modules/systemd.py +12 -9
- ansible/modules/systemd_service.py +12 -9
- ansible/modules/sysvinit.py +7 -2
- ansible/modules/tempfile.py +7 -2
- ansible/modules/template.py +2 -3
- ansible/modules/unarchive.py +13 -3
- ansible/modules/uri.py +5 -8
- ansible/modules/user.py +11 -10
- ansible/modules/validate_argument_spec.py +15 -16
- ansible/modules/wait_for.py +1 -2
- ansible/modules/wait_for_connection.py +1 -2
- ansible/modules/yum_repository.py +2 -3
- ansible/parsing/__init__.py +1 -3
- ansible/parsing/ajson.py +1 -3
- ansible/parsing/dataloader.py +23 -12
- ansible/parsing/mod_args.py +14 -8
- ansible/parsing/plugin_docs.py +1 -2
- ansible/parsing/quoting.py +1 -3
- ansible/parsing/splitter.py +1 -3
- ansible/parsing/utils/__init__.py +1 -3
- ansible/parsing/utils/addresses.py +1 -3
- ansible/parsing/utils/jsonify.py +1 -3
- ansible/parsing/utils/yaml.py +1 -3
- ansible/parsing/vault/__init__.py +6 -8
- ansible/parsing/yaml/__init__.py +1 -3
- ansible/parsing/yaml/constructor.py +1 -3
- ansible/parsing/yaml/dumper.py +1 -3
- ansible/parsing/yaml/loader.py +1 -3
- ansible/parsing/yaml/objects.py +1 -3
- ansible/playbook/__init__.py +1 -3
- ansible/playbook/attribute.py +1 -3
- ansible/playbook/base.py +2 -3
- ansible/playbook/block.py +1 -3
- ansible/playbook/collectionsearch.py +1 -2
- ansible/playbook/conditional.py +1 -3
- ansible/playbook/delegatable.py +1 -0
- ansible/playbook/handler.py +2 -4
- ansible/playbook/handler_task_include.py +1 -3
- ansible/playbook/helpers.py +1 -4
- ansible/playbook/included_file.py +4 -4
- ansible/playbook/loop_control.py +1 -3
- ansible/playbook/notifiable.py +1 -0
- ansible/playbook/play.py +1 -3
- ansible/playbook/play_context.py +1 -3
- ansible/playbook/playbook_include.py +1 -3
- ansible/playbook/role/__init__.py +1 -3
- ansible/playbook/role/definition.py +1 -3
- ansible/playbook/role/include.py +1 -3
- ansible/playbook/role/metadata.py +1 -3
- ansible/playbook/role/requirement.py +1 -3
- ansible/playbook/role_include.py +2 -10
- ansible/playbook/taggable.py +1 -3
- ansible/playbook/task.py +2 -4
- ansible/playbook/task_include.py +1 -3
- ansible/plugins/__init__.py +4 -5
- ansible/plugins/action/__init__.py +20 -14
- ansible/plugins/action/add_host.py +2 -4
- ansible/plugins/action/assemble.py +2 -3
- ansible/plugins/action/assert.py +1 -2
- ansible/plugins/action/async_status.py +1 -2
- ansible/plugins/action/command.py +1 -2
- ansible/plugins/action/copy.py +12 -9
- ansible/plugins/action/debug.py +1 -2
- ansible/plugins/action/dnf.py +4 -4
- ansible/plugins/action/fail.py +1 -2
- ansible/plugins/action/fetch.py +2 -3
- ansible/plugins/action/gather_facts.py +3 -4
- ansible/plugins/action/group_by.py +1 -2
- ansible/plugins/action/include_vars.py +1 -2
- ansible/plugins/action/normal.py +1 -2
- ansible/plugins/action/package.py +36 -21
- ansible/plugins/action/pause.py +1 -2
- ansible/plugins/action/raw.py +2 -3
- ansible/plugins/action/reboot.py +30 -15
- ansible/plugins/action/script.py +3 -4
- ansible/plugins/action/service.py +1 -2
- ansible/plugins/action/set_fact.py +1 -2
- ansible/plugins/action/set_stats.py +1 -2
- ansible/plugins/action/shell.py +1 -2
- ansible/plugins/action/template.py +1 -2
- ansible/plugins/action/unarchive.py +1 -2
- ansible/plugins/action/uri.py +2 -3
- ansible/plugins/action/validate_argument_spec.py +1 -2
- ansible/plugins/action/wait_for_connection.py +2 -3
- ansible/plugins/become/__init__.py +1 -2
- ansible/plugins/become/runas.py +1 -2
- ansible/plugins/become/su.py +1 -2
- ansible/plugins/become/sudo.py +1 -2
- ansible/plugins/cache/__init__.py +3 -3
- ansible/plugins/cache/base.py +1 -2
- ansible/plugins/cache/jsonfile.py +1 -3
- ansible/plugins/cache/memory.py +1 -2
- ansible/plugins/callback/__init__.py +2 -4
- ansible/plugins/callback/default.py +2 -3
- ansible/plugins/callback/junit.py +1 -2
- ansible/plugins/callback/minimal.py +1 -3
- ansible/plugins/callback/oneline.py +1 -3
- ansible/plugins/callback/tree.py +1 -2
- ansible/plugins/cliconf/__init__.py +1 -2
- ansible/plugins/connection/__init__.py +4 -5
- ansible/plugins/connection/local.py +3 -4
- ansible/plugins/connection/paramiko_ssh.py +1 -2
- ansible/plugins/connection/psrp.py +1 -2
- ansible/plugins/connection/ssh.py +18 -54
- ansible/plugins/connection/winrm.py +3 -4
- ansible/plugins/doc_fragments/action_common_attributes.py +2 -3
- ansible/plugins/doc_fragments/action_core.py +3 -4
- ansible/plugins/doc_fragments/backup.py +1 -2
- ansible/plugins/doc_fragments/connection_pipelining.py +1 -2
- ansible/plugins/doc_fragments/constructed.py +1 -2
- ansible/plugins/doc_fragments/decrypt.py +2 -3
- ansible/plugins/doc_fragments/default_callback.py +1 -2
- ansible/plugins/doc_fragments/files.py +1 -2
- ansible/plugins/doc_fragments/inventory_cache.py +1 -2
- ansible/plugins/doc_fragments/result_format_callback.py +1 -2
- ansible/plugins/doc_fragments/return_common.py +1 -2
- ansible/plugins/doc_fragments/shell_common.py +1 -2
- ansible/plugins/doc_fragments/shell_windows.py +1 -2
- ansible/plugins/doc_fragments/template_common.py +1 -2
- ansible/plugins/doc_fragments/url.py +1 -2
- ansible/plugins/doc_fragments/url_windows.py +1 -2
- ansible/plugins/doc_fragments/validate.py +1 -2
- ansible/plugins/doc_fragments/vars_plugin_staging.py +1 -2
- ansible/plugins/filter/__init__.py +1 -2
- ansible/plugins/filter/b64decode.yml +8 -8
- ansible/plugins/filter/b64encode.yml +4 -4
- ansible/plugins/filter/comment.yml +1 -1
- ansible/plugins/filter/core.py +11 -9
- ansible/plugins/filter/encryption.py +1 -3
- ansible/plugins/filter/extract.yml +1 -1
- ansible/plugins/filter/from_yaml_all.yml +1 -1
- ansible/plugins/filter/human_readable.yml +3 -3
- ansible/plugins/filter/human_to_bytes.yml +2 -2
- ansible/plugins/filter/mandatory.yml +1 -1
- ansible/plugins/filter/mathstuff.py +2 -2
- ansible/plugins/filter/password_hash.yml +3 -2
- ansible/plugins/filter/regex_replace.yml +15 -0
- ansible/plugins/filter/regex_search.yml +12 -0
- ansible/plugins/filter/strftime.yml +2 -9
- ansible/plugins/filter/to_datetime.yml +17 -2
- ansible/plugins/filter/to_nice_json.yml +4 -0
- ansible/plugins/filter/union.yml +1 -1
- ansible/plugins/filter/urls.py +1 -2
- ansible/plugins/filter/urlsplit.py +1 -2
- ansible/plugins/filter/zip.yml +2 -2
- ansible/plugins/filter/zip_longest.yml +1 -1
- ansible/plugins/httpapi/__init__.py +1 -2
- ansible/plugins/inventory/__init__.py +2 -4
- ansible/plugins/inventory/advanced_host_list.py +1 -2
- ansible/plugins/inventory/auto.py +2 -3
- ansible/plugins/inventory/constructed.py +3 -2
- ansible/plugins/inventory/generator.py +1 -2
- ansible/plugins/inventory/host_list.py +1 -2
- ansible/plugins/inventory/ini.py +1 -2
- ansible/plugins/inventory/script.py +122 -3
- ansible/plugins/inventory/toml.py +1 -2
- ansible/plugins/inventory/yaml.py +3 -4
- ansible/plugins/list.py +2 -3
- ansible/plugins/loader.py +10 -11
- ansible/plugins/lookup/__init__.py +1 -3
- ansible/plugins/lookup/config.py +19 -15
- ansible/plugins/lookup/csvfile.py +16 -7
- ansible/plugins/lookup/dict.py +2 -3
- ansible/plugins/lookup/env.py +4 -4
- ansible/plugins/lookup/file.py +1 -2
- ansible/plugins/lookup/fileglob.py +1 -2
- ansible/plugins/lookup/first_found.py +8 -7
- ansible/plugins/lookup/indexed_items.py +1 -2
- ansible/plugins/lookup/ini.py +6 -3
- ansible/plugins/lookup/inventory_hostnames.py +1 -2
- ansible/plugins/lookup/items.py +1 -2
- ansible/plugins/lookup/lines.py +1 -2
- ansible/plugins/lookup/list.py +1 -3
- ansible/plugins/lookup/nested.py +1 -2
- ansible/plugins/lookup/password.py +16 -14
- ansible/plugins/lookup/pipe.py +1 -2
- ansible/plugins/lookup/random_choice.py +1 -2
- ansible/plugins/lookup/sequence.py +21 -52
- ansible/plugins/lookup/subelements.py +1 -2
- ansible/plugins/lookup/template.py +1 -2
- ansible/plugins/lookup/together.py +1 -2
- ansible/plugins/lookup/unvault.py +1 -2
- ansible/plugins/lookup/url.py +9 -3
- ansible/plugins/lookup/varnames.py +1 -2
- ansible/plugins/lookup/vars.py +1 -2
- ansible/plugins/netconf/__init__.py +1 -2
- ansible/plugins/shell/__init__.py +3 -4
- ansible/plugins/shell/cmd.py +1 -2
- ansible/plugins/shell/powershell.py +1 -2
- ansible/plugins/shell/sh.py +1 -2
- ansible/plugins/strategy/__init__.py +33 -21
- ansible/plugins/strategy/debug.py +1 -2
- ansible/plugins/strategy/free.py +17 -7
- ansible/plugins/strategy/host_pinned.py +1 -3
- ansible/plugins/strategy/linear.py +22 -22
- ansible/plugins/terminal/__init__.py +2 -3
- ansible/plugins/test/__init__.py +1 -2
- ansible/plugins/test/change.yml +1 -1
- ansible/plugins/test/changed.yml +1 -1
- ansible/plugins/test/contains.yml +1 -1
- ansible/plugins/test/core.py +2 -4
- ansible/plugins/test/exists.yml +1 -1
- ansible/plugins/test/failed.yml +1 -1
- ansible/plugins/test/failure.yml +1 -1
- ansible/plugins/test/files.py +1 -3
- ansible/plugins/test/finished.yml +3 -3
- ansible/plugins/test/issuperset.yml +1 -1
- ansible/plugins/test/match.yml +1 -1
- ansible/plugins/test/mathstuff.py +1 -2
- ansible/plugins/test/reachable.yml +1 -1
- ansible/plugins/test/regex.yml +1 -1
- ansible/plugins/test/search.yml +1 -1
- ansible/plugins/test/skip.yml +1 -1
- ansible/plugins/test/skipped.yml +1 -1
- ansible/plugins/test/started.yml +1 -1
- ansible/plugins/test/succeeded.yml +1 -1
- ansible/plugins/test/success.yml +1 -1
- ansible/plugins/test/successful.yml +1 -1
- ansible/plugins/test/superset.yml +1 -1
- ansible/plugins/test/unreachable.yml +1 -1
- ansible/plugins/test/uri.py +1 -3
- ansible/plugins/vars/__init__.py +1 -2
- ansible/plugins/vars/host_group_vars.py +2 -3
- ansible/release.py +3 -5
- ansible/template/__init__.py +24 -37
- ansible/template/native_helpers.py +1 -3
- ansible/template/template.py +1 -3
- ansible/template/vars.py +1 -0
- ansible/utils/__init__.py +1 -3
- ansible/utils/cmd_functions.py +1 -2
- ansible/utils/collection_loader/__init__.py +1 -2
- ansible/utils/collection_loader/_collection_config.py +1 -2
- ansible/utils/collection_loader/_collection_finder.py +1 -2
- ansible/utils/collection_loader/_collection_meta.py +1 -2
- ansible/utils/color.py +1 -2
- ansible/utils/context_objects.py +1 -4
- ansible/utils/display.py +88 -30
- ansible/utils/encrypt.py +4 -105
- ansible/utils/fqcn.py +1 -2
- ansible/utils/galaxy.py +1 -3
- ansible/utils/hashing.py +1 -3
- ansible/utils/helpers.py +1 -3
- ansible/utils/jsonrpc.py +1 -2
- ansible/utils/listify.py +1 -3
- ansible/utils/lock.py +1 -3
- ansible/utils/multiprocessing.py +1 -3
- ansible/utils/native_jinja.py +1 -3
- ansible/utils/path.py +1 -2
- ansible/utils/plugin_docs.py +7 -6
- ansible/utils/py3compat.py +17 -55
- ansible/utils/sentinel.py +1 -3
- ansible/utils/shlex.py +1 -3
- ansible/utils/singleton.py +1 -3
- ansible/utils/ssh_functions.py +1 -3
- ansible/utils/unicode.py +1 -3
- ansible/utils/unsafe_proxy.py +1 -2
- ansible/utils/vars.py +6 -8
- ansible/utils/version.py +1 -3
- ansible/vars/clean.py +1 -3
- ansible/vars/fact_cache.py +1 -2
- ansible/vars/hostvars.py +3 -7
- ansible/vars/manager.py +24 -6
- ansible/vars/reserved.py +1 -3
- {ansible_core-2.16.6.data → ansible_core-2.17.0rc1.data}/scripts/ansible-test +1 -2
- {ansible_core-2.16.6.dist-info → ansible_core-2.17.0rc1.dist-info}/METADATA +3 -3
- ansible_core-2.17.0rc1.dist-info/RECORD +987 -0
- ansible_test/__init__.py +1 -2
- ansible_test/_data/completion/docker.txt +7 -9
- ansible_test/_data/completion/remote.txt +6 -7
- ansible_test/_data/requirements/ansible-test.txt +0 -2
- ansible_test/_data/requirements/constraints.txt +1 -6
- ansible_test/_data/requirements/sanity.ansible-doc.txt +3 -3
- ansible_test/_data/requirements/sanity.changelog.txt +3 -3
- ansible_test/_data/requirements/sanity.import.plugin.txt +2 -2
- ansible_test/_data/requirements/sanity.mypy.txt +12 -12
- ansible_test/_data/requirements/sanity.pep8.txt +1 -1
- ansible_test/_data/requirements/sanity.pylint.txt +7 -7
- ansible_test/_data/requirements/sanity.runtime-metadata.txt +1 -1
- ansible_test/_data/requirements/sanity.validate-modules.txt +3 -3
- ansible_test/_data/requirements/sanity.yamllint.txt +2 -2
- ansible_test/_internal/bootstrap.py +2 -2
- ansible_test/_internal/classification/__init__.py +0 -5
- ansible_test/_internal/commands/integration/cloud/cs.py +1 -1
- ansible_test/_internal/commands/integration/cloud/nios.py +1 -1
- ansible_test/_internal/commands/sanity/__init__.py +1 -27
- ansible_test/_internal/commands/sanity/import.py +0 -18
- ansible_test/_internal/commands/sanity/mypy.py +7 -10
- ansible_test/_internal/commands/units/__init__.py +1 -1
- ansible_test/_internal/config.py +0 -1
- ansible_test/_internal/content_config.py +0 -5
- ansible_test/_internal/coverage_util.py +0 -1
- ansible_test/_internal/docker_util.py +1 -1
- ansible_test/_internal/host_profiles.py +5 -4
- ansible_test/_internal/python_requirements.py +1 -119
- ansible_test/_internal/ssh.py +1 -0
- ansible_test/_internal/util.py +1 -1
- ansible_test/_internal/util_common.py +1 -1
- ansible_test/_internal/venv.py +10 -108
- ansible_test/_util/__init__.py +1 -2
- ansible_test/_util/controller/sanity/mypy/ansible-core.ini +0 -6
- ansible_test/_util/controller/sanity/mypy/modules.ini +0 -6
- ansible_test/_util/controller/sanity/pylint/config/ansible-test-target.cfg +0 -1
- ansible_test/_util/controller/sanity/pylint/config/ansible-test.cfg +0 -1
- ansible_test/_util/controller/sanity/pylint/config/code-smell.cfg +0 -1
- ansible_test/_util/controller/sanity/pylint/config/collection.cfg +0 -1
- ansible_test/_util/controller/sanity/pylint/config/default.cfg +0 -1
- ansible_test/_util/controller/sanity/pylint/plugins/deprecated.py +1 -2
- ansible_test/_util/controller/sanity/shellcheck/exclude.txt +0 -1
- ansible_test/_util/controller/sanity/validate-modules/validate_modules/main.py +31 -59
- ansible_test/_util/controller/sanity/validate-modules/validate_modules/module_args.py +0 -7
- ansible_test/_util/controller/sanity/validate-modules/validate_modules/schema.py +10 -2
- ansible_test/_util/controller/sanity/validate-modules/validate_modules/utils.py +1 -1
- ansible_test/_util/controller/sanity/yamllint/yamllinter.py +16 -4
- ansible_test/_util/target/__init__.py +1 -2
- ansible_test/_util/target/cli/ansible_test_cli_stub.py +1 -2
- ansible_test/_util/target/common/constants.py +1 -4
- ansible_test/_util/target/injector/python.py +4 -19
- ansible_test/_util/target/pytest/plugins/ansible_forked.py +2 -9
- ansible_test/_util/target/pytest/plugins/ansible_pytest_collections.py +1 -5
- ansible_test/_util/target/pytest/plugins/ansible_pytest_coverage.py +1 -2
- ansible_test/_util/target/sanity/compile/compile.py +3 -12
- ansible_test/_util/target/sanity/import/importer.py +1 -12
- ansible_test/_util/target/setup/bootstrap.sh +49 -105
- ansible_test/_util/target/setup/probe_cgroups.py +1 -2
- ansible_test/_util/target/setup/quiet_pip.py +1 -16
- ansible_test/_util/target/setup/requirements.py +9 -2
- ansible_test/_util/target/tools/virtualenvcheck.py +1 -2
- ansible_test/_util/target/tools/yamlcheck.py +1 -2
- ansible/module_utils/common/_json_compat.py +0 -16
- ansible/module_utils/compat/_selectors2.py +0 -655
- ansible/modules/yum.py +0 -1821
- ansible/plugins/action/yum.py +0 -111
- ansible_core-2.16.6.dist-info/RECORD +0 -1009
- ansible_test/_util/controller/sanity/code-smell/future-import-boilerplate.json +0 -7
- ansible_test/_util/controller/sanity/code-smell/future-import-boilerplate.py +0 -46
- ansible_test/_util/controller/sanity/code-smell/metaclass-boilerplate.json +0 -7
- ansible_test/_util/controller/sanity/code-smell/metaclass-boilerplate.py +0 -44
- ansible_test/_util/controller/sanity/code-smell/no-basestring.json +0 -7
- ansible_test/_util/controller/sanity/code-smell/no-basestring.py +0 -21
- ansible_test/_util/controller/sanity/code-smell/no-dict-iteritems.json +0 -7
- ansible_test/_util/controller/sanity/code-smell/no-dict-iteritems.py +0 -21
- ansible_test/_util/controller/sanity/code-smell/no-dict-iterkeys.json +0 -7
- ansible_test/_util/controller/sanity/code-smell/no-dict-iterkeys.py +0 -21
- ansible_test/_util/controller/sanity/code-smell/no-dict-itervalues.json +0 -7
- ansible_test/_util/controller/sanity/code-smell/no-dict-itervalues.py +0 -21
- ansible_test/_util/controller/sanity/code-smell/no-main-display.json +0 -10
- ansible_test/_util/controller/sanity/code-smell/no-main-display.py +0 -21
- ansible_test/_util/controller/sanity/code-smell/no-unicode-literals.json +0 -7
- ansible_test/_util/controller/sanity/code-smell/no-unicode-literals.py +0 -21
- ansible_test/_util/controller/tools/sslcheck.py +0 -22
- ansible_test/_util/target/common/__init__.py +0 -2
- {ansible_core-2.16.6.dist-info → ansible_core-2.17.0rc1.dist-info}/COPYING +0 -0
- {ansible_core-2.16.6.dist-info → ansible_core-2.17.0rc1.dist-info}/WHEEL +0 -0
- {ansible_core-2.16.6.dist-info → ansible_core-2.17.0rc1.dist-info}/entry_points.txt +0 -0
- {ansible_core-2.16.6.dist-info → ansible_core-2.17.0rc1.dist-info}/top_level.txt +0 -0
|
@@ -4,8 +4,7 @@
|
|
|
4
4
|
# CAUTION: This implementation of the collection loader is used by ansible-test.
|
|
5
5
|
# Because of this, it must be compatible with all Python versions supported on the controller or remote.
|
|
6
6
|
|
|
7
|
-
from __future__ import
|
|
8
|
-
__metaclass__ = type
|
|
7
|
+
from __future__ import annotations
|
|
9
8
|
|
|
10
9
|
try:
|
|
11
10
|
from collections.abc import Mapping
|
ansible/utils/color.py
CHANGED
|
@@ -14,8 +14,7 @@
|
|
|
14
14
|
#
|
|
15
15
|
# You should have received a copy of the GNU General Public License
|
|
16
16
|
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
|
17
|
-
from __future__ import
|
|
18
|
-
__metaclass__ = type
|
|
17
|
+
from __future__ import annotations
|
|
19
18
|
|
|
20
19
|
import re
|
|
21
20
|
import sys
|
ansible/utils/context_objects.py
CHANGED
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
# Copyright: (c) 2018, Ansible Project
|
|
2
2
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
|
3
3
|
|
|
4
|
-
# Make coding more python3-ish
|
|
5
|
-
from __future__ import (absolute_import, division, print_function)
|
|
6
|
-
__metaclass__ = type
|
|
7
|
-
|
|
8
4
|
"""
|
|
9
5
|
Hold command line arguments for use in other modules
|
|
10
6
|
"""
|
|
7
|
+
from __future__ import annotations
|
|
11
8
|
|
|
12
9
|
from abc import ABCMeta
|
|
13
10
|
from collections.abc import Container, Mapping, Sequence, Set
|
ansible/utils/display.py
CHANGED
|
@@ -59,6 +59,8 @@ if t.TYPE_CHECKING:
|
|
|
59
59
|
# avoid circular import at runtime
|
|
60
60
|
from ansible.executor.task_queue_manager import FinalQueue
|
|
61
61
|
|
|
62
|
+
P = t.ParamSpec('P')
|
|
63
|
+
|
|
62
64
|
_LIBC = ctypes.cdll.LoadLibrary(ctypes.util.find_library('c'))
|
|
63
65
|
# Set argtypes, to avoid segfault if the wrong type is provided,
|
|
64
66
|
# restype is assumed to be c_int
|
|
@@ -122,20 +124,6 @@ def get_text_width(text: str) -> int:
|
|
|
122
124
|
return width if width >= 0 else 0
|
|
123
125
|
|
|
124
126
|
|
|
125
|
-
def proxy_display(method):
|
|
126
|
-
|
|
127
|
-
def proxyit(self, *args, **kwargs):
|
|
128
|
-
if self._final_q:
|
|
129
|
-
# If _final_q is set, that means we are in a WorkerProcess
|
|
130
|
-
# and instead of displaying messages directly from the fork
|
|
131
|
-
# we will proxy them through the queue
|
|
132
|
-
return self._final_q.send_display(method.__name__, *args, **kwargs)
|
|
133
|
-
else:
|
|
134
|
-
return method(self, *args, **kwargs)
|
|
135
|
-
|
|
136
|
-
return proxyit
|
|
137
|
-
|
|
138
|
-
|
|
139
127
|
class FilterBlackList(logging.Filter):
|
|
140
128
|
def __init__(self, blacklist):
|
|
141
129
|
self.blacklist = [logging.Filter(name) for name in blacklist]
|
|
@@ -283,6 +271,11 @@ class Display(metaclass=Singleton):
|
|
|
283
271
|
self.columns = None
|
|
284
272
|
self.verbosity = verbosity
|
|
285
273
|
|
|
274
|
+
if C.LOG_VERBOSITY is None:
|
|
275
|
+
self.log_verbosity = verbosity
|
|
276
|
+
else:
|
|
277
|
+
self.log_verbosity = max(verbosity, C.LOG_VERBOSITY)
|
|
278
|
+
|
|
286
279
|
# list of all deprecation messages to prevent duplicate display
|
|
287
280
|
self._deprecations: dict[str, int] = {}
|
|
288
281
|
self._warns: dict[str, int] = {}
|
|
@@ -354,7 +347,49 @@ class Display(metaclass=Singleton):
|
|
|
354
347
|
if os.path.exists(b_cow_path):
|
|
355
348
|
self.b_cowsay = b_cow_path
|
|
356
349
|
|
|
357
|
-
@
|
|
350
|
+
@staticmethod
|
|
351
|
+
def _proxy(
|
|
352
|
+
func: c.Callable[t.Concatenate[Display, P], None]
|
|
353
|
+
) -> c.Callable[..., None]:
|
|
354
|
+
@wraps(func)
|
|
355
|
+
def wrapper(self, *args: P.args, **kwargs: P.kwargs) -> None:
|
|
356
|
+
if self._final_q:
|
|
357
|
+
# If _final_q is set, that means we are in a WorkerProcess
|
|
358
|
+
# and instead of displaying messages directly from the fork
|
|
359
|
+
# we will proxy them through the queue
|
|
360
|
+
return self._final_q.send_display(func.__name__, *args, **kwargs)
|
|
361
|
+
return func(self, *args, **kwargs)
|
|
362
|
+
return wrapper
|
|
363
|
+
|
|
364
|
+
@staticmethod
|
|
365
|
+
def _meets_debug(
|
|
366
|
+
func: c.Callable[..., None]
|
|
367
|
+
) -> c.Callable[..., None]:
|
|
368
|
+
"""This method ensures that debug is enabled before delegating to the proxy
|
|
369
|
+
"""
|
|
370
|
+
@wraps(func)
|
|
371
|
+
def wrapper(self, msg: str, host: str | None = None) -> None:
|
|
372
|
+
if not C.DEFAULT_DEBUG:
|
|
373
|
+
return
|
|
374
|
+
return func(self, msg, host=host)
|
|
375
|
+
return wrapper
|
|
376
|
+
|
|
377
|
+
@staticmethod
|
|
378
|
+
def _meets_verbosity(
|
|
379
|
+
func: c.Callable[..., None]
|
|
380
|
+
) -> c.Callable[..., None]:
|
|
381
|
+
"""This method ensures the verbosity has been met before delegating to the proxy
|
|
382
|
+
|
|
383
|
+
Currently this method is unused, and the logic is handled directly in ``verbose``
|
|
384
|
+
"""
|
|
385
|
+
@wraps(func)
|
|
386
|
+
def wrapper(self, msg: str, host: str | None = None, caplevel: int = None) -> None:
|
|
387
|
+
if self.verbosity > caplevel:
|
|
388
|
+
return func(self, msg, host=host, caplevel=caplevel)
|
|
389
|
+
return
|
|
390
|
+
return wrapper
|
|
391
|
+
|
|
392
|
+
@_proxy
|
|
358
393
|
def display(
|
|
359
394
|
self,
|
|
360
395
|
msg: str,
|
|
@@ -412,7 +447,12 @@ class Display(metaclass=Singleton):
|
|
|
412
447
|
# raise
|
|
413
448
|
|
|
414
449
|
if logger and not screen_only:
|
|
415
|
-
|
|
450
|
+
self._log(nocolor, color)
|
|
451
|
+
|
|
452
|
+
def _log(self, msg: str, color: str | None = None, caplevel: int | None = None):
|
|
453
|
+
|
|
454
|
+
if caplevel is None or self.log_verbosity > caplevel:
|
|
455
|
+
msg2 = msg.lstrip('\n')
|
|
416
456
|
|
|
417
457
|
lvl = logging.INFO
|
|
418
458
|
if color:
|
|
@@ -443,21 +483,35 @@ class Display(metaclass=Singleton):
|
|
|
443
483
|
def vvvvvv(self, msg: str, host: str | None = None) -> None:
|
|
444
484
|
return self.verbose(msg, host=host, caplevel=5)
|
|
445
485
|
|
|
446
|
-
def debug(self, msg: str, host: str | None = None) -> None:
|
|
447
|
-
if C.DEFAULT_DEBUG:
|
|
448
|
-
if host is None:
|
|
449
|
-
self.display("%6d %0.5f: %s" % (os.getpid(), time.time(), msg), color=C.COLOR_DEBUG)
|
|
450
|
-
else:
|
|
451
|
-
self.display("%6d %0.5f [%s]: %s" % (os.getpid(), time.time(), host, msg), color=C.COLOR_DEBUG)
|
|
452
|
-
|
|
453
486
|
def verbose(self, msg: str, host: str | None = None, caplevel: int = 2) -> None:
|
|
487
|
+
if self.verbosity > caplevel:
|
|
488
|
+
self._verbose_display(msg, host=host, caplevel=caplevel)
|
|
454
489
|
|
|
490
|
+
if self.log_verbosity > self.verbosity and self.log_verbosity > caplevel:
|
|
491
|
+
self._verbose_log(msg, host=host, caplevel=caplevel)
|
|
492
|
+
|
|
493
|
+
@_proxy
|
|
494
|
+
def _verbose_display(self, msg: str, host: str | None = None, caplevel: int = 2) -> None:
|
|
455
495
|
to_stderr = C.VERBOSE_TO_STDERR
|
|
456
|
-
if
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
496
|
+
if host is None:
|
|
497
|
+
self.display(msg, color=C.COLOR_VERBOSE, stderr=to_stderr)
|
|
498
|
+
else:
|
|
499
|
+
self.display("<%s> %s" % (host, msg), color=C.COLOR_VERBOSE, stderr=to_stderr)
|
|
500
|
+
|
|
501
|
+
@_proxy
|
|
502
|
+
def _verbose_log(self, msg: str, host: str | None = None, caplevel: int = 2) -> None:
|
|
503
|
+
# we send to log if log was configured with higher verbosity
|
|
504
|
+
if host is not None:
|
|
505
|
+
msg = "<%s> %s" % (host, msg)
|
|
506
|
+
self._log(msg, C.COLOR_VERBOSE, caplevel)
|
|
507
|
+
|
|
508
|
+
@_meets_debug
|
|
509
|
+
@_proxy
|
|
510
|
+
def debug(self, msg: str, host: str | None = None) -> None:
|
|
511
|
+
if host is None:
|
|
512
|
+
self.display("%6d %0.5f: %s" % (os.getpid(), time.time(), msg), color=C.COLOR_DEBUG)
|
|
513
|
+
else:
|
|
514
|
+
self.display("%6d %0.5f [%s]: %s" % (os.getpid(), time.time(), host, msg), color=C.COLOR_DEBUG)
|
|
461
515
|
|
|
462
516
|
def get_deprecation_message(
|
|
463
517
|
self,
|
|
@@ -501,7 +555,7 @@ class Display(metaclass=Singleton):
|
|
|
501
555
|
|
|
502
556
|
return message_text
|
|
503
557
|
|
|
504
|
-
@
|
|
558
|
+
@_proxy
|
|
505
559
|
def deprecated(
|
|
506
560
|
self,
|
|
507
561
|
msg: str,
|
|
@@ -525,7 +579,7 @@ class Display(metaclass=Singleton):
|
|
|
525
579
|
self.display(message_text.strip(), color=C.COLOR_DEPRECATE, stderr=True)
|
|
526
580
|
self._deprecations[message_text] = 1
|
|
527
581
|
|
|
528
|
-
@
|
|
582
|
+
@_proxy
|
|
529
583
|
def warning(self, msg: str, formatted: bool = False) -> None:
|
|
530
584
|
|
|
531
585
|
if not formatted:
|
|
@@ -539,10 +593,12 @@ class Display(metaclass=Singleton):
|
|
|
539
593
|
self.display(new_msg, color=C.COLOR_WARN, stderr=True)
|
|
540
594
|
self._warns[new_msg] = 1
|
|
541
595
|
|
|
596
|
+
@_proxy
|
|
542
597
|
def system_warning(self, msg: str) -> None:
|
|
543
598
|
if C.SYSTEM_WARNINGS:
|
|
544
599
|
self.warning(msg)
|
|
545
600
|
|
|
601
|
+
@_proxy
|
|
546
602
|
def banner(self, msg: str, color: str | None = None, cows: bool = True) -> None:
|
|
547
603
|
'''
|
|
548
604
|
Prints a header-looking line with cowsay or stars with length depending on terminal width (3 minimum)
|
|
@@ -566,6 +622,7 @@ class Display(metaclass=Singleton):
|
|
|
566
622
|
stars = u"*" * star_len
|
|
567
623
|
self.display(u"\n%s %s" % (msg, stars), color=color)
|
|
568
624
|
|
|
625
|
+
@_proxy
|
|
569
626
|
def banner_cowsay(self, msg: str, color: str | None = None) -> None:
|
|
570
627
|
if u": [" in msg:
|
|
571
628
|
msg = msg.replace(u"[", u"")
|
|
@@ -583,6 +640,7 @@ class Display(metaclass=Singleton):
|
|
|
583
640
|
(out, err) = cmd.communicate()
|
|
584
641
|
self.display(u"%s\n" % to_text(out), color=color)
|
|
585
642
|
|
|
643
|
+
@_proxy
|
|
586
644
|
def error(self, msg: str, wrap_text: bool = True) -> None:
|
|
587
645
|
if wrap_text:
|
|
588
646
|
new_msg = u"\n[ERROR]: %s" % msg
|
ansible/utils/encrypt.py
CHANGED
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
# (c) 2012-2014, Michael DeHaan <michael.dehaan@gmail.com>
|
|
2
2
|
# (c) 2017 Ansible Project
|
|
3
3
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
|
4
|
-
from __future__ import
|
|
5
|
-
__metaclass__ = type
|
|
4
|
+
from __future__ import annotations
|
|
6
5
|
|
|
7
6
|
import random
|
|
8
|
-
import re
|
|
9
7
|
import string
|
|
10
|
-
import sys
|
|
11
8
|
|
|
12
9
|
from collections import namedtuple
|
|
13
10
|
|
|
@@ -17,8 +14,8 @@ from ansible.module_utils.six import text_type
|
|
|
17
14
|
from ansible.module_utils.common.text.converters import to_text, to_bytes
|
|
18
15
|
from ansible.utils.display import Display
|
|
19
16
|
|
|
20
|
-
PASSLIB_E =
|
|
21
|
-
|
|
17
|
+
PASSLIB_E = None
|
|
18
|
+
PASSLIB_AVAILABLE = False
|
|
22
19
|
try:
|
|
23
20
|
import passlib
|
|
24
21
|
import passlib.hash
|
|
@@ -31,12 +28,6 @@ try:
|
|
|
31
28
|
except Exception as e:
|
|
32
29
|
PASSLIB_E = e
|
|
33
30
|
|
|
34
|
-
try:
|
|
35
|
-
import crypt
|
|
36
|
-
HAS_CRYPT = True
|
|
37
|
-
except Exception as e:
|
|
38
|
-
CRYPT_E = e
|
|
39
|
-
|
|
40
31
|
|
|
41
32
|
display = Display()
|
|
42
33
|
|
|
@@ -84,96 +75,6 @@ class BaseHash(object):
|
|
|
84
75
|
self.algorithm = algorithm
|
|
85
76
|
|
|
86
77
|
|
|
87
|
-
class CryptHash(BaseHash):
|
|
88
|
-
def __init__(self, algorithm):
|
|
89
|
-
super(CryptHash, self).__init__(algorithm)
|
|
90
|
-
|
|
91
|
-
if not HAS_CRYPT:
|
|
92
|
-
raise AnsibleError("crypt.crypt cannot be used as the 'crypt' python library is not installed or is unusable.", orig_exc=CRYPT_E)
|
|
93
|
-
|
|
94
|
-
if sys.platform.startswith('darwin'):
|
|
95
|
-
raise AnsibleError("crypt.crypt not supported on Mac OS X/Darwin, install passlib python module")
|
|
96
|
-
|
|
97
|
-
if algorithm not in self.algorithms:
|
|
98
|
-
raise AnsibleError("crypt.crypt does not support '%s' algorithm" % self.algorithm)
|
|
99
|
-
|
|
100
|
-
display.deprecated(
|
|
101
|
-
"Encryption using the Python crypt module is deprecated. The "
|
|
102
|
-
"Python crypt module is deprecated and will be removed from "
|
|
103
|
-
"Python 3.13. Install the passlib library for continued "
|
|
104
|
-
"encryption functionality.",
|
|
105
|
-
version="2.17",
|
|
106
|
-
)
|
|
107
|
-
|
|
108
|
-
self.algo_data = self.algorithms[algorithm]
|
|
109
|
-
|
|
110
|
-
def hash(self, secret, salt=None, salt_size=None, rounds=None, ident=None):
|
|
111
|
-
salt = self._salt(salt, salt_size)
|
|
112
|
-
rounds = self._rounds(rounds)
|
|
113
|
-
ident = self._ident(ident)
|
|
114
|
-
return self._hash(secret, salt, rounds, ident)
|
|
115
|
-
|
|
116
|
-
def _salt(self, salt, salt_size):
|
|
117
|
-
salt_size = salt_size or self.algo_data.salt_size
|
|
118
|
-
ret = salt or random_salt(salt_size)
|
|
119
|
-
if re.search(r'[^./0-9A-Za-z]', ret):
|
|
120
|
-
raise AnsibleError("invalid characters in salt")
|
|
121
|
-
if self.algo_data.salt_exact and len(ret) != self.algo_data.salt_size:
|
|
122
|
-
raise AnsibleError("invalid salt size")
|
|
123
|
-
elif not self.algo_data.salt_exact and len(ret) > self.algo_data.salt_size:
|
|
124
|
-
raise AnsibleError("invalid salt size")
|
|
125
|
-
return ret
|
|
126
|
-
|
|
127
|
-
def _rounds(self, rounds):
|
|
128
|
-
if self.algorithm == 'bcrypt':
|
|
129
|
-
# crypt requires 2 digits for rounds
|
|
130
|
-
return rounds or self.algo_data.implicit_rounds
|
|
131
|
-
elif rounds == self.algo_data.implicit_rounds:
|
|
132
|
-
# Passlib does not include the rounds if it is the same as implicit_rounds.
|
|
133
|
-
# Make crypt lib behave the same, by not explicitly specifying the rounds in that case.
|
|
134
|
-
return None
|
|
135
|
-
else:
|
|
136
|
-
return rounds
|
|
137
|
-
|
|
138
|
-
def _ident(self, ident):
|
|
139
|
-
if not ident:
|
|
140
|
-
return self.algo_data.crypt_id
|
|
141
|
-
if self.algorithm == 'bcrypt':
|
|
142
|
-
return ident
|
|
143
|
-
return None
|
|
144
|
-
|
|
145
|
-
def _hash(self, secret, salt, rounds, ident):
|
|
146
|
-
saltstring = ""
|
|
147
|
-
if ident:
|
|
148
|
-
saltstring = "$%s" % ident
|
|
149
|
-
|
|
150
|
-
if rounds:
|
|
151
|
-
if self.algorithm == 'bcrypt':
|
|
152
|
-
saltstring += "$%d" % rounds
|
|
153
|
-
else:
|
|
154
|
-
saltstring += "$rounds=%d" % rounds
|
|
155
|
-
|
|
156
|
-
saltstring += "$%s" % salt
|
|
157
|
-
|
|
158
|
-
# crypt.crypt throws OSError on Python >= 3.9 if it cannot parse saltstring.
|
|
159
|
-
try:
|
|
160
|
-
result = crypt.crypt(secret, saltstring)
|
|
161
|
-
orig_exc = None
|
|
162
|
-
except OSError as e:
|
|
163
|
-
result = None
|
|
164
|
-
orig_exc = e
|
|
165
|
-
|
|
166
|
-
# None as result would be interpreted by some modules (user module)
|
|
167
|
-
# as no password at all.
|
|
168
|
-
if not result:
|
|
169
|
-
raise AnsibleError(
|
|
170
|
-
"crypt.crypt does not support '%s' algorithm" % self.algorithm,
|
|
171
|
-
orig_exc=orig_exc,
|
|
172
|
-
)
|
|
173
|
-
|
|
174
|
-
return result
|
|
175
|
-
|
|
176
|
-
|
|
177
78
|
class PasslibHash(BaseHash):
|
|
178
79
|
def __init__(self, algorithm):
|
|
179
80
|
super(PasslibHash, self).__init__(algorithm)
|
|
@@ -274,6 +175,4 @@ def passlib_or_crypt(secret, algorithm, salt=None, salt_size=None, rounds=None,
|
|
|
274
175
|
def do_encrypt(result, encrypt, salt_size=None, salt=None, ident=None, rounds=None):
|
|
275
176
|
if PASSLIB_AVAILABLE:
|
|
276
177
|
return PasslibHash(encrypt).hash(result, salt=salt, salt_size=salt_size, rounds=rounds, ident=ident)
|
|
277
|
-
|
|
278
|
-
return CryptHash(encrypt).hash(result, salt=salt, salt_size=salt_size, rounds=rounds, ident=ident)
|
|
279
|
-
raise AnsibleError("Unable to encrypt nor hash, either crypt or passlib must be installed.", orig_exc=CRYPT_E)
|
|
178
|
+
raise AnsibleError("Unable to encrypt nor hash, passlib must be installed", orig_exc=PASSLIB_E)
|
ansible/utils/fqcn.py
CHANGED
|
@@ -14,8 +14,7 @@
|
|
|
14
14
|
#
|
|
15
15
|
# You should have received a copy of the GNU General Public License
|
|
16
16
|
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
|
17
|
-
from __future__ import
|
|
18
|
-
__metaclass__ = type
|
|
17
|
+
from __future__ import annotations
|
|
19
18
|
|
|
20
19
|
|
|
21
20
|
def add_internal_fqcns(names):
|
ansible/utils/galaxy.py
CHANGED
|
@@ -15,9 +15,7 @@
|
|
|
15
15
|
# You should have received a copy of the GNU General Public License
|
|
16
16
|
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
|
17
17
|
|
|
18
|
-
|
|
19
|
-
from __future__ import (absolute_import, division, print_function)
|
|
20
|
-
__metaclass__ = type
|
|
18
|
+
from __future__ import annotations
|
|
21
19
|
|
|
22
20
|
import os
|
|
23
21
|
import tempfile
|
ansible/utils/hashing.py
CHANGED
|
@@ -15,9 +15,7 @@
|
|
|
15
15
|
# You should have received a copy of the GNU General Public License
|
|
16
16
|
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
|
17
17
|
|
|
18
|
-
|
|
19
|
-
from __future__ import (absolute_import, division, print_function)
|
|
20
|
-
__metaclass__ = type
|
|
18
|
+
from __future__ import annotations
|
|
21
19
|
|
|
22
20
|
import os
|
|
23
21
|
|
ansible/utils/helpers.py
CHANGED
|
@@ -15,9 +15,7 @@
|
|
|
15
15
|
# You should have received a copy of the GNU General Public License
|
|
16
16
|
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
|
17
17
|
|
|
18
|
-
|
|
19
|
-
from __future__ import (absolute_import, division, print_function)
|
|
20
|
-
__metaclass__ = type
|
|
18
|
+
from __future__ import annotations
|
|
21
19
|
|
|
22
20
|
from ansible.module_utils.six import string_types
|
|
23
21
|
|
ansible/utils/jsonrpc.py
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
# (c) 2017, Peter Sprygada <psprygad@redhat.com>
|
|
2
2
|
# (c) 2017 Ansible Project
|
|
3
3
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
|
4
|
-
from __future__ import
|
|
5
|
-
__metaclass__ = type
|
|
4
|
+
from __future__ import annotations
|
|
6
5
|
|
|
7
6
|
import json
|
|
8
7
|
import pickle
|
ansible/utils/listify.py
CHANGED
|
@@ -15,9 +15,7 @@
|
|
|
15
15
|
# You should have received a copy of the GNU General Public License
|
|
16
16
|
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
|
17
17
|
|
|
18
|
-
|
|
19
|
-
from __future__ import (absolute_import, division, print_function)
|
|
20
|
-
__metaclass__ = type
|
|
18
|
+
from __future__ import annotations
|
|
21
19
|
|
|
22
20
|
from collections.abc import Iterable
|
|
23
21
|
|
ansible/utils/lock.py
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
# Copyright (c) 2020 Matt Martz <matt@sivel.net>
|
|
2
2
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
from __future__ import (absolute_import, division, print_function)
|
|
6
|
-
__metaclass__ = type
|
|
4
|
+
from __future__ import annotations
|
|
7
5
|
|
|
8
6
|
from functools import wraps
|
|
9
7
|
|
ansible/utils/multiprocessing.py
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
# Copyright (c) 2019 Matt Martz <matt@sivel.net>
|
|
2
2
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
from __future__ import (absolute_import, division, print_function)
|
|
6
|
-
__metaclass__ = type
|
|
4
|
+
from __future__ import annotations
|
|
7
5
|
|
|
8
6
|
import multiprocessing
|
|
9
7
|
|
ansible/utils/native_jinja.py
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
# Copyright: (c) 2020, Ansible Project
|
|
2
2
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
from __future__ import (absolute_import, division, print_function)
|
|
6
|
-
__metaclass__ = type
|
|
4
|
+
from __future__ import annotations
|
|
7
5
|
|
|
8
6
|
|
|
9
7
|
from ansible.module_utils.six import text_type
|
ansible/utils/path.py
CHANGED
|
@@ -14,8 +14,7 @@
|
|
|
14
14
|
#
|
|
15
15
|
# You should have received a copy of the GNU General Public License
|
|
16
16
|
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
|
17
|
-
from __future__ import
|
|
18
|
-
__metaclass__ = type
|
|
17
|
+
from __future__ import annotations
|
|
19
18
|
|
|
20
19
|
import os
|
|
21
20
|
import shutil
|
ansible/utils/plugin_docs.py
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
# Copyright: (c) 2012, Jan-Piet Mens <jpmens () gmail.com>
|
|
2
2
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
|
3
3
|
|
|
4
|
-
from __future__ import
|
|
5
|
-
__metaclass__ = type
|
|
4
|
+
from __future__ import annotations
|
|
6
5
|
|
|
7
6
|
from collections.abc import MutableMapping, MutableSet, MutableSequence
|
|
8
7
|
from pathlib import Path
|
|
@@ -128,7 +127,7 @@ def add_fragments(doc, filename, fragment_loader, is_module=False):
|
|
|
128
127
|
fragments = doc.pop('extends_documentation_fragment', [])
|
|
129
128
|
|
|
130
129
|
if isinstance(fragments, string_types):
|
|
131
|
-
fragments =
|
|
130
|
+
fragments = fragments.split(',')
|
|
132
131
|
|
|
133
132
|
unknown_fragments = []
|
|
134
133
|
|
|
@@ -138,7 +137,7 @@ def add_fragments(doc, filename, fragment_loader, is_module=False):
|
|
|
138
137
|
# as-specified. If failure, assume the right-most component is a var, split it off,
|
|
139
138
|
# and retry the load.
|
|
140
139
|
for fragment_slug in fragments:
|
|
141
|
-
fragment_name = fragment_slug
|
|
140
|
+
fragment_name = fragment_slug.strip()
|
|
142
141
|
fragment_var = 'DOCUMENTATION'
|
|
143
142
|
|
|
144
143
|
fragment_class = fragment_loader.get(fragment_name)
|
|
@@ -314,7 +313,7 @@ def find_plugin_docfile(plugin, plugin_type, loader):
|
|
|
314
313
|
if filename is None:
|
|
315
314
|
raise AnsibleError('%s cannot contain DOCUMENTATION nor does it have a companion documentation file' % (plugin))
|
|
316
315
|
|
|
317
|
-
return filename, context
|
|
316
|
+
return filename, context
|
|
318
317
|
|
|
319
318
|
|
|
320
319
|
def get_plugin_docs(plugin, plugin_type, loader, fragment_loader, verbose):
|
|
@@ -323,7 +322,8 @@ def get_plugin_docs(plugin, plugin_type, loader, fragment_loader, verbose):
|
|
|
323
322
|
|
|
324
323
|
# find plugin doc file, if it doesn't exist this will throw error, we let it through
|
|
325
324
|
# can raise exception and short circuit when 'not found'
|
|
326
|
-
filename,
|
|
325
|
+
filename, context = find_plugin_docfile(plugin, plugin_type, loader)
|
|
326
|
+
collection_name = context.plugin_resolved_collection
|
|
327
327
|
|
|
328
328
|
try:
|
|
329
329
|
docs = get_docstring(filename, fragment_loader, verbose=verbose, collection_name=collection_name, plugin_type=plugin_type)
|
|
@@ -347,5 +347,6 @@ def get_plugin_docs(plugin, plugin_type, loader, fragment_loader, verbose):
|
|
|
347
347
|
else:
|
|
348
348
|
docs[0]['filename'] = filename
|
|
349
349
|
docs[0]['collection'] = collection_name
|
|
350
|
+
docs[0]['plugin_name'] = context.resolved_fqcn
|
|
350
351
|
|
|
351
352
|
return docs
|
ansible/utils/py3compat.py
CHANGED
|
@@ -1,70 +1,32 @@
|
|
|
1
1
|
# -*- coding: utf-8 -*-
|
|
2
2
|
#
|
|
3
3
|
# (c) 2018, Toshio Kuratomi <a.badger@gmail.com>
|
|
4
|
+
# Copyright: Contributors to the Ansible project
|
|
4
5
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
|
5
|
-
#
|
|
6
|
-
# Note that the original author of this, Toshio Kuratomi, is trying to submit this to six. If
|
|
7
|
-
# successful, the code in six will be available under six's more liberal license:
|
|
8
|
-
# https://mail.python.org/pipermail/python-porting/2018-July/000539.html
|
|
9
6
|
|
|
10
|
-
|
|
11
|
-
from __future__ import (absolute_import, division, print_function)
|
|
12
|
-
__metaclass__ = type
|
|
7
|
+
from __future__ import annotations
|
|
13
8
|
|
|
9
|
+
import inspect
|
|
14
10
|
import os
|
|
15
|
-
import sys
|
|
16
|
-
|
|
17
|
-
from collections.abc import MutableMapping
|
|
18
|
-
|
|
19
|
-
from ansible.module_utils.six import PY3
|
|
20
|
-
from ansible.module_utils.common.text.converters import to_bytes, to_text
|
|
21
|
-
|
|
22
|
-
__all__ = ('environ',)
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
class _TextEnviron(MutableMapping):
|
|
26
|
-
"""
|
|
27
|
-
Utility class to return text strings from the environment instead of byte strings
|
|
28
11
|
|
|
29
|
-
|
|
30
|
-
"""
|
|
31
|
-
def __init__(self, env=None, encoding=None):
|
|
32
|
-
if env is None:
|
|
33
|
-
env = os.environ
|
|
34
|
-
self._raw_environ = env
|
|
35
|
-
self._value_cache = {}
|
|
36
|
-
# Since we're trying to mimic Python3's os.environ, use sys.getfilesystemencoding()
|
|
37
|
-
# instead of utf-8
|
|
38
|
-
if encoding is None:
|
|
39
|
-
# Since we're trying to mimic Python3's os.environ, use sys.getfilesystemencoding()
|
|
40
|
-
# instead of utf-8
|
|
41
|
-
self.encoding = sys.getfilesystemencoding()
|
|
42
|
-
else:
|
|
43
|
-
self.encoding = encoding
|
|
12
|
+
from ansible.utils.display import Display
|
|
44
13
|
|
|
45
|
-
def __delitem__(self, key):
|
|
46
|
-
del self._raw_environ[key]
|
|
47
14
|
|
|
48
|
-
|
|
49
|
-
value = self._raw_environ[key]
|
|
50
|
-
if PY3:
|
|
51
|
-
return value
|
|
52
|
-
# Cache keys off of the undecoded values to handle any environment variables which change
|
|
53
|
-
# during a run
|
|
54
|
-
if value not in self._value_cache:
|
|
55
|
-
self._value_cache[value] = to_text(value, encoding=self.encoding,
|
|
56
|
-
nonstring='passthru', errors='surrogate_or_strict')
|
|
57
|
-
return self._value_cache[value]
|
|
15
|
+
display = Display()
|
|
58
16
|
|
|
59
|
-
def __setitem__(self, key, value):
|
|
60
|
-
self._raw_environ[key] = to_bytes(value, encoding=self.encoding, nonstring='strict',
|
|
61
|
-
errors='surrogate_or_strict')
|
|
62
17
|
|
|
63
|
-
|
|
64
|
-
|
|
18
|
+
def __getattr__(name):
|
|
19
|
+
if name != 'environ':
|
|
20
|
+
raise AttributeError(name)
|
|
65
21
|
|
|
66
|
-
|
|
67
|
-
return len(self._raw_environ)
|
|
22
|
+
caller = inspect.stack()[1]
|
|
68
23
|
|
|
24
|
+
display.deprecated(
|
|
25
|
+
(
|
|
26
|
+
'ansible.utils.py3compat.environ is deprecated in favor of os.environ. '
|
|
27
|
+
f'Accessed by {caller.filename} line number {caller.lineno}'
|
|
28
|
+
),
|
|
29
|
+
version='2.20',
|
|
30
|
+
)
|
|
69
31
|
|
|
70
|
-
environ
|
|
32
|
+
return os.environ
|
ansible/utils/sentinel.py
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
# Copyright (c) 2019 Ansible Project
|
|
2
2
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
from __future__ import (absolute_import, division, print_function)
|
|
6
|
-
__metaclass__ = type
|
|
4
|
+
from __future__ import annotations
|
|
7
5
|
|
|
8
6
|
|
|
9
7
|
class Sentinel:
|
ansible/utils/shlex.py
CHANGED
|
@@ -15,9 +15,7 @@
|
|
|
15
15
|
# You should have received a copy of the GNU General Public License
|
|
16
16
|
# alongwith Ansible. If not, see <http://www.gnu.org/licenses/>.
|
|
17
17
|
|
|
18
|
-
|
|
19
|
-
from __future__ import (absolute_import, division, print_function)
|
|
20
|
-
__metaclass__ = type
|
|
18
|
+
from __future__ import annotations
|
|
21
19
|
|
|
22
20
|
import shlex
|
|
23
21
|
|
ansible/utils/singleton.py
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
# Copyright (c) 2017 Ansible Project
|
|
2
2
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
from __future__ import (absolute_import, division, print_function)
|
|
6
|
-
__metaclass__ = type
|
|
4
|
+
from __future__ import annotations
|
|
7
5
|
|
|
8
6
|
from threading import RLock
|
|
9
7
|
|