ansible-core 2.16.7__py3-none-any.whl → 2.17.0__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 +326 -202
- 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 +1 -3
- 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 +2 -3
- 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 +39 -46
- ansible/modules/dnf5.py +28 -26
- 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 +12 -15
- ansible/modules/user.py +11 -4
- 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 +6 -4
- 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 +19 -13
- 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 -11
- 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 +14 -27
- 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 +89 -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.7.data → ansible_core-2.17.0.data}/scripts/ansible-test +1 -2
- {ansible_core-2.16.7.dist-info → ansible_core-2.17.0.dist-info}/METADATA +3 -3
- ansible_core-2.17.0.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/pypi_proxy.py +1 -8
- 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.7.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.7.dist-info → ansible_core-2.17.0.dist-info}/COPYING +0 -0
- {ansible_core-2.16.7.dist-info → ansible_core-2.17.0.dist-info}/WHEEL +0 -0
- {ansible_core-2.16.7.dist-info → ansible_core-2.17.0.dist-info}/entry_points.txt +0 -0
- {ansible_core-2.16.7.dist-info → ansible_core-2.17.0.dist-info}/top_level.txt +0 -0
|
@@ -5,7 +5,6 @@ import base64
|
|
|
5
5
|
import dataclasses
|
|
6
6
|
import json
|
|
7
7
|
import os
|
|
8
|
-
import re
|
|
9
8
|
import typing as t
|
|
10
9
|
|
|
11
10
|
from .encoding import (
|
|
@@ -20,14 +19,9 @@ from .io import (
|
|
|
20
19
|
from .util import (
|
|
21
20
|
ANSIBLE_TEST_DATA_ROOT,
|
|
22
21
|
ANSIBLE_TEST_TARGET_ROOT,
|
|
23
|
-
ANSIBLE_TEST_TOOLS_ROOT,
|
|
24
22
|
ApplicationError,
|
|
25
23
|
SubprocessError,
|
|
26
24
|
display,
|
|
27
|
-
find_executable,
|
|
28
|
-
raw_command,
|
|
29
|
-
str_to_version,
|
|
30
|
-
version_to_str,
|
|
31
25
|
)
|
|
32
26
|
|
|
33
27
|
from .util_common import (
|
|
@@ -63,9 +57,6 @@ from .coverage_util import (
|
|
|
63
57
|
QUIET_PIP_SCRIPT_PATH = os.path.join(ANSIBLE_TEST_TARGET_ROOT, 'setup', 'quiet_pip.py')
|
|
64
58
|
REQUIREMENTS_SCRIPT_PATH = os.path.join(ANSIBLE_TEST_TARGET_ROOT, 'setup', 'requirements.py')
|
|
65
59
|
|
|
66
|
-
# IMPORTANT: Keep this in sync with the ansible-test.txt requirements file.
|
|
67
|
-
VIRTUALENV_VERSION = '16.7.12'
|
|
68
|
-
|
|
69
60
|
# Pip Abstraction
|
|
70
61
|
|
|
71
62
|
|
|
@@ -132,7 +123,6 @@ def install_requirements(
|
|
|
132
123
|
ansible: bool = False,
|
|
133
124
|
command: bool = False,
|
|
134
125
|
coverage: bool = False,
|
|
135
|
-
virtualenv: bool = False,
|
|
136
126
|
controller: bool = True,
|
|
137
127
|
connection: t.Optional[Connection] = None,
|
|
138
128
|
) -> None:
|
|
@@ -145,8 +135,6 @@ def install_requirements(
|
|
|
145
135
|
if command and isinstance(args, (UnitsConfig, IntegrationConfig)) and args.coverage:
|
|
146
136
|
coverage = True
|
|
147
137
|
|
|
148
|
-
cryptography = False
|
|
149
|
-
|
|
150
138
|
if ansible:
|
|
151
139
|
try:
|
|
152
140
|
ansible_cache = install_requirements.ansible_cache # type: ignore[attr-defined]
|
|
@@ -160,19 +148,12 @@ def install_requirements(
|
|
|
160
148
|
else:
|
|
161
149
|
ansible_cache[python.path] = True
|
|
162
150
|
|
|
163
|
-
# Install the latest cryptography version that the current requirements can support if it is not already available.
|
|
164
|
-
# This avoids downgrading cryptography when OS packages provide a newer version than we are able to install using pip.
|
|
165
|
-
# If not installed here, later install commands may try to install a version of cryptography which cannot be installed.
|
|
166
|
-
cryptography = not is_cryptography_available(python.path)
|
|
167
|
-
|
|
168
151
|
commands = collect_requirements(
|
|
169
152
|
python=python,
|
|
170
153
|
controller=controller,
|
|
171
154
|
ansible=ansible,
|
|
172
|
-
cryptography=cryptography,
|
|
173
155
|
command=args.command if command else None,
|
|
174
156
|
coverage=coverage,
|
|
175
|
-
virtualenv=virtualenv,
|
|
176
157
|
minimize=False,
|
|
177
158
|
sanity=None,
|
|
178
159
|
)
|
|
@@ -205,9 +186,7 @@ def collect_requirements(
|
|
|
205
186
|
python: PythonConfig,
|
|
206
187
|
controller: bool,
|
|
207
188
|
ansible: bool,
|
|
208
|
-
cryptography: bool,
|
|
209
189
|
coverage: bool,
|
|
210
|
-
virtualenv: bool,
|
|
211
190
|
minimize: bool,
|
|
212
191
|
command: t.Optional[str],
|
|
213
192
|
sanity: t.Optional[str],
|
|
@@ -215,17 +194,9 @@ def collect_requirements(
|
|
|
215
194
|
"""Collect requirements for the given Python using the specified arguments."""
|
|
216
195
|
commands: list[PipCommand] = []
|
|
217
196
|
|
|
218
|
-
if virtualenv:
|
|
219
|
-
# sanity tests on Python 2.x install virtualenv when it is too old or is not already installed and the `--requirements` option is given
|
|
220
|
-
# the last version of virtualenv with no dependencies is used to minimize the changes made outside a virtual environment
|
|
221
|
-
commands.extend(collect_package_install(packages=[f'virtualenv=={VIRTUALENV_VERSION}'], constraints=False))
|
|
222
|
-
|
|
223
197
|
if coverage:
|
|
224
198
|
commands.extend(collect_package_install(packages=[f'coverage=={get_coverage_version(python.version).coverage_version}'], constraints=False))
|
|
225
199
|
|
|
226
|
-
if cryptography:
|
|
227
|
-
commands.extend(collect_package_install(packages=get_cryptography_requirements(python)))
|
|
228
|
-
|
|
229
200
|
if ansible or command:
|
|
230
201
|
commands.extend(collect_general_install(command, ansible))
|
|
231
202
|
|
|
@@ -446,17 +417,7 @@ def get_venv_packages(python: PythonConfig) -> dict[str, str]:
|
|
|
446
417
|
wheel='0.37.1',
|
|
447
418
|
)
|
|
448
419
|
|
|
449
|
-
override_packages = {
|
|
450
|
-
'2.7': dict(
|
|
451
|
-
pip='20.3.4', # 21.0 requires Python 3.6+
|
|
452
|
-
setuptools='44.1.1', # 45.0.0 requires Python 3.5+
|
|
453
|
-
wheel=None,
|
|
454
|
-
),
|
|
455
|
-
'3.6': dict(
|
|
456
|
-
pip='21.3.1', # 22.0 requires Python 3.7+
|
|
457
|
-
setuptools='59.6.0', # 59.7.0 requires Python 3.7+
|
|
458
|
-
wheel=None,
|
|
459
|
-
),
|
|
420
|
+
override_packages: dict[str, dict[str, str]] = {
|
|
460
421
|
}
|
|
461
422
|
|
|
462
423
|
packages = {name: version or default_packages[name] for name, version in override_packages.get(python.version, default_packages).items()}
|
|
@@ -510,82 +471,3 @@ def prepare_pip_script(commands: list[PipCommand]) -> str:
|
|
|
510
471
|
def usable_pip_file(path: t.Optional[str]) -> bool:
|
|
511
472
|
"""Return True if the specified pip file is usable, otherwise False."""
|
|
512
473
|
return bool(path) and os.path.exists(path) and bool(os.path.getsize(path))
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
# Cryptography
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
def is_cryptography_available(python: str) -> bool:
|
|
519
|
-
"""Return True if cryptography is available for the given python."""
|
|
520
|
-
try:
|
|
521
|
-
raw_command([python, '-c', 'import cryptography'], capture=True)
|
|
522
|
-
except SubprocessError:
|
|
523
|
-
return False
|
|
524
|
-
|
|
525
|
-
return True
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
def get_cryptography_requirements(python: PythonConfig) -> list[str]:
|
|
529
|
-
"""
|
|
530
|
-
Return the correct cryptography and pyopenssl requirements for the given python version.
|
|
531
|
-
The version of cryptography installed depends on the python version and openssl version.
|
|
532
|
-
"""
|
|
533
|
-
openssl_version = get_openssl_version(python)
|
|
534
|
-
|
|
535
|
-
if openssl_version and openssl_version < (1, 1, 0):
|
|
536
|
-
# cryptography 3.2 requires openssl 1.1.x or later
|
|
537
|
-
# see https://cryptography.io/en/latest/changelog.html#v3-2
|
|
538
|
-
cryptography = 'cryptography < 3.2'
|
|
539
|
-
# pyopenssl 20.0.0 requires cryptography 3.2 or later
|
|
540
|
-
pyopenssl = 'pyopenssl < 20.0.0'
|
|
541
|
-
else:
|
|
542
|
-
# cryptography 3.4+ builds require a working rust toolchain
|
|
543
|
-
# systems bootstrapped using ansible-core-ci can access additional wheels through the spare-tire package index
|
|
544
|
-
cryptography = 'cryptography'
|
|
545
|
-
# any future installation of pyopenssl is free to use any compatible version of cryptography
|
|
546
|
-
pyopenssl = ''
|
|
547
|
-
|
|
548
|
-
requirements = [
|
|
549
|
-
cryptography,
|
|
550
|
-
pyopenssl,
|
|
551
|
-
]
|
|
552
|
-
|
|
553
|
-
requirements = [requirement for requirement in requirements if requirement]
|
|
554
|
-
|
|
555
|
-
return requirements
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
def get_openssl_version(python: PythonConfig) -> t.Optional[tuple[int, ...]]:
|
|
559
|
-
"""Return the openssl version."""
|
|
560
|
-
if not python.version.startswith('2.'):
|
|
561
|
-
# OpenSSL version checking only works on Python 3.x.
|
|
562
|
-
# This should be the most accurate, since it is the Python we will be using.
|
|
563
|
-
version = json.loads(raw_command([python.path, os.path.join(ANSIBLE_TEST_TOOLS_ROOT, 'sslcheck.py')], capture=True)[0])['version']
|
|
564
|
-
|
|
565
|
-
if version:
|
|
566
|
-
display.info(f'Detected OpenSSL version {version_to_str(version)} under Python {python.version}.', verbosity=1)
|
|
567
|
-
|
|
568
|
-
return tuple(version)
|
|
569
|
-
|
|
570
|
-
# Fall back to detecting the OpenSSL version from the CLI.
|
|
571
|
-
# This should provide an adequate solution on Python 2.x.
|
|
572
|
-
openssl_path = find_executable('openssl', required=False)
|
|
573
|
-
|
|
574
|
-
if openssl_path:
|
|
575
|
-
try:
|
|
576
|
-
result = raw_command([openssl_path, 'version'], capture=True)[0]
|
|
577
|
-
except SubprocessError:
|
|
578
|
-
result = ''
|
|
579
|
-
|
|
580
|
-
match = re.search(r'^OpenSSL (?P<version>[0-9]+\.[0-9]+\.[0-9]+)', result)
|
|
581
|
-
|
|
582
|
-
if match:
|
|
583
|
-
version = str_to_version(match.group('version'))
|
|
584
|
-
|
|
585
|
-
display.info(f'Detected OpenSSL version {version_to_str(version)} using the openssl CLI.', verbosity=1)
|
|
586
|
-
|
|
587
|
-
return version
|
|
588
|
-
|
|
589
|
-
display.info('Unable to detect OpenSSL version.', verbosity=1)
|
|
590
|
-
|
|
591
|
-
return None
|
ansible_test/_internal/ssh.py
CHANGED
|
@@ -245,6 +245,7 @@ def create_ssh_port_forwards(
|
|
|
245
245
|
"""
|
|
246
246
|
options: dict[str, t.Union[str, int]] = dict(
|
|
247
247
|
LogLevel='INFO', # info level required to get messages on stderr indicating the ports assigned to each forward
|
|
248
|
+
ControlPath='none', # if the user has ControlPath set up for every host, it will prevent creation of forwards
|
|
248
249
|
)
|
|
249
250
|
|
|
250
251
|
cli_args = []
|
ansible_test/_internal/util.py
CHANGED
|
@@ -998,7 +998,7 @@ def retry(func: t.Callable[..., TValue], ex_type: t.Type[BaseException] = Subpro
|
|
|
998
998
|
def parse_to_list_of_dict(pattern: str, value: str) -> list[dict[str, str]]:
|
|
999
999
|
"""Parse lines from the given value using the specified pattern and return the extracted list of key/value pair dictionaries."""
|
|
1000
1000
|
matched = []
|
|
1001
|
-
unmatched = []
|
|
1001
|
+
unmatched: list[str] = []
|
|
1002
1002
|
|
|
1003
1003
|
for line in value.splitlines():
|
|
1004
1004
|
match = re.search(pattern, line)
|
|
@@ -409,7 +409,7 @@ def create_interpreter_wrapper(interpreter: str, injected_interpreter: str) -> N
|
|
|
409
409
|
code = textwrap.dedent('''
|
|
410
410
|
#!%s
|
|
411
411
|
|
|
412
|
-
from __future__ import
|
|
412
|
+
from __future__ import annotations
|
|
413
413
|
|
|
414
414
|
from os import execv
|
|
415
415
|
from sys import argv
|
ansible_test/_internal/venv.py
CHANGED
|
@@ -15,7 +15,6 @@ from .config import (
|
|
|
15
15
|
from .util import (
|
|
16
16
|
find_python,
|
|
17
17
|
SubprocessError,
|
|
18
|
-
get_available_python_versions,
|
|
19
18
|
ANSIBLE_TEST_TARGET_TOOLS_ROOT,
|
|
20
19
|
display,
|
|
21
20
|
remove_tree,
|
|
@@ -85,49 +84,21 @@ def create_virtual_environment(
|
|
|
85
84
|
system_site_packages: bool = False,
|
|
86
85
|
pip: bool = False,
|
|
87
86
|
) -> bool:
|
|
88
|
-
"""Create a virtual environment using venv
|
|
87
|
+
"""Create a virtual environment using venv for the requested Python version."""
|
|
89
88
|
if not os.path.exists(python.path):
|
|
90
89
|
# the requested python version could not be found
|
|
91
90
|
return False
|
|
92
91
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
if run_venv(args, real_python, system_site_packages, pip, path):
|
|
100
|
-
display.info('Created Python %s virtual environment using "venv": %s' % (python.version, path), verbosity=1)
|
|
101
|
-
return True
|
|
102
|
-
|
|
103
|
-
# something went wrong, most likely the package maintainer for the Python installation removed ensurepip
|
|
104
|
-
# which will prevent creation of a virtual environment without installation of other OS packages
|
|
105
|
-
|
|
106
|
-
# use the installed 'virtualenv' module on the Python requested version
|
|
107
|
-
if run_virtualenv(args, python.path, python.path, system_site_packages, pip, path):
|
|
108
|
-
display.info('Created Python %s virtual environment using "virtualenv": %s' % (python.version, path), verbosity=1)
|
|
109
|
-
return True
|
|
110
|
-
|
|
111
|
-
available_pythons = get_available_python_versions()
|
|
112
|
-
|
|
113
|
-
for available_python_version, available_python_interpreter in sorted(available_pythons.items()):
|
|
114
|
-
if available_python_interpreter == python.path:
|
|
115
|
-
# already attempted to use this interpreter
|
|
116
|
-
continue
|
|
117
|
-
|
|
118
|
-
virtualenv_version = get_virtualenv_version(args, available_python_interpreter)
|
|
119
|
-
|
|
120
|
-
if not virtualenv_version:
|
|
121
|
-
# virtualenv not available for this Python or we were unable to detect the version
|
|
122
|
-
continue
|
|
123
|
-
|
|
124
|
-
# try using 'virtualenv' from another Python to setup the desired version
|
|
125
|
-
if run_virtualenv(args, available_python_interpreter, python.path, system_site_packages, pip, path):
|
|
126
|
-
display.info('Created Python %s virtual environment using "virtualenv" on Python %s: %s' % (python.version, available_python_version, path),
|
|
127
|
-
verbosity=1)
|
|
92
|
+
# creating a virtual environment using 'venv' when running in a virtual environment created by 'virtualenv' results
|
|
93
|
+
# in a copy of the original virtual environment instead of creation of a new one
|
|
94
|
+
# avoid this issue by only using "real" python interpreters to invoke 'venv'
|
|
95
|
+
for real_python in iterate_real_pythons(python.version):
|
|
96
|
+
if run_venv(args, real_python, system_site_packages, pip, path):
|
|
97
|
+
display.info('Created Python %s virtual environment using "venv": %s' % (python.version, path), verbosity=1)
|
|
128
98
|
return True
|
|
129
99
|
|
|
130
|
-
#
|
|
100
|
+
# something went wrong, most likely the package maintainer for the Python installation removed ensurepip
|
|
101
|
+
# which will prevent creation of a virtual environment without installation of other OS packages
|
|
131
102
|
return False
|
|
132
103
|
|
|
133
104
|
|
|
@@ -188,7 +159,7 @@ def run_venv(
|
|
|
188
159
|
pip: bool,
|
|
189
160
|
path: str,
|
|
190
161
|
) -> bool:
|
|
191
|
-
"""Create a virtual environment using the 'venv' module.
|
|
162
|
+
"""Create a virtual environment using the 'venv' module."""
|
|
192
163
|
cmd = [run_python, '-m', 'venv']
|
|
193
164
|
|
|
194
165
|
if system_site_packages:
|
|
@@ -210,72 +181,3 @@ def run_venv(
|
|
|
210
181
|
return False
|
|
211
182
|
|
|
212
183
|
return True
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
def run_virtualenv(
|
|
216
|
-
args: EnvironmentConfig,
|
|
217
|
-
run_python: str,
|
|
218
|
-
env_python: str,
|
|
219
|
-
system_site_packages: bool,
|
|
220
|
-
pip: bool,
|
|
221
|
-
path: str,
|
|
222
|
-
) -> bool:
|
|
223
|
-
"""Create a virtual environment using the 'virtualenv' module."""
|
|
224
|
-
# always specify which interpreter to use to guarantee the desired interpreter is provided
|
|
225
|
-
# otherwise virtualenv may select a different interpreter than the one running virtualenv
|
|
226
|
-
cmd = [run_python, '-m', 'virtualenv', '--python', env_python]
|
|
227
|
-
|
|
228
|
-
if system_site_packages:
|
|
229
|
-
cmd.append('--system-site-packages')
|
|
230
|
-
|
|
231
|
-
if not pip:
|
|
232
|
-
cmd.append('--no-pip')
|
|
233
|
-
# these options provide consistency with venv, which does not install them without pip
|
|
234
|
-
cmd.append('--no-setuptools')
|
|
235
|
-
cmd.append('--no-wheel')
|
|
236
|
-
|
|
237
|
-
cmd.append(path)
|
|
238
|
-
|
|
239
|
-
try:
|
|
240
|
-
run_command(args, cmd, capture=True)
|
|
241
|
-
except SubprocessError as ex:
|
|
242
|
-
remove_tree(path)
|
|
243
|
-
|
|
244
|
-
if args.verbosity > 1:
|
|
245
|
-
display.error(ex.message)
|
|
246
|
-
|
|
247
|
-
return False
|
|
248
|
-
|
|
249
|
-
return True
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
def get_virtualenv_version(args: EnvironmentConfig, python: str) -> t.Optional[tuple[int, ...]]:
|
|
253
|
-
"""Get the virtualenv version for the given python interpreter, if available, otherwise return None."""
|
|
254
|
-
try:
|
|
255
|
-
cache = get_virtualenv_version.cache # type: ignore[attr-defined]
|
|
256
|
-
except AttributeError:
|
|
257
|
-
cache = get_virtualenv_version.cache = {} # type: ignore[attr-defined]
|
|
258
|
-
|
|
259
|
-
if python not in cache:
|
|
260
|
-
try:
|
|
261
|
-
stdout = run_command(args, [python, '-m', 'virtualenv', '--version'], capture=True)[0]
|
|
262
|
-
except SubprocessError as ex:
|
|
263
|
-
stdout = ''
|
|
264
|
-
|
|
265
|
-
if args.verbosity > 1:
|
|
266
|
-
display.error(ex.message)
|
|
267
|
-
|
|
268
|
-
version = None
|
|
269
|
-
|
|
270
|
-
if stdout:
|
|
271
|
-
# noinspection PyBroadException
|
|
272
|
-
try:
|
|
273
|
-
version = str_to_version(stdout.strip())
|
|
274
|
-
except Exception: # pylint: disable=broad-except
|
|
275
|
-
pass
|
|
276
|
-
|
|
277
|
-
cache[python] = version
|
|
278
|
-
|
|
279
|
-
version = cache[python]
|
|
280
|
-
|
|
281
|
-
return version
|
ansible_test/_util/__init__.py
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
# Empty __init__.py to
|
|
2
|
-
# This allows the ansible-test entry point to report supported Python versions before exiting.
|
|
1
|
+
# Empty __init__.py to keep pylint happy.
|
|
@@ -46,9 +46,6 @@ ignore_missing_imports = True
|
|
|
46
46
|
[mypy-lxml.*]
|
|
47
47
|
ignore_missing_imports = True
|
|
48
48
|
|
|
49
|
-
[mypy-yum.*]
|
|
50
|
-
ignore_missing_imports = True
|
|
51
|
-
|
|
52
49
|
[mypy-rpmUtils.*]
|
|
53
50
|
ignore_missing_imports = True
|
|
54
51
|
|
|
@@ -85,9 +82,6 @@ ignore_missing_imports = True
|
|
|
85
82
|
[mypy-distro.*]
|
|
86
83
|
ignore_missing_imports = True
|
|
87
84
|
|
|
88
|
-
[mypy-selectors2.*]
|
|
89
|
-
ignore_missing_imports = True
|
|
90
|
-
|
|
91
85
|
[mypy-resolvelib.*]
|
|
92
86
|
ignore_missing_imports = True
|
|
93
87
|
|
|
@@ -13,9 +13,6 @@ ignore_missing_imports = True
|
|
|
13
13
|
[mypy-md5.*]
|
|
14
14
|
ignore_missing_imports = True
|
|
15
15
|
|
|
16
|
-
[mypy-yum.*]
|
|
17
|
-
ignore_missing_imports = True
|
|
18
|
-
|
|
19
16
|
[mypy-rpmUtils.*]
|
|
20
17
|
ignore_missing_imports = True
|
|
21
18
|
|
|
@@ -52,9 +49,6 @@ ignore_missing_imports = True
|
|
|
52
49
|
[mypy-distro.*]
|
|
53
50
|
ignore_missing_imports = True
|
|
54
51
|
|
|
55
|
-
[mypy-selectors2.*]
|
|
56
|
-
ignore_missing_imports = True
|
|
57
|
-
|
|
58
52
|
[mypy-selinux.*]
|
|
59
53
|
ignore_missing_imports = True
|
|
60
54
|
|
|
@@ -32,7 +32,6 @@ except ImportError:
|
|
|
32
32
|
from pylint.checkers import BaseChecker, BaseTokenChecker
|
|
33
33
|
|
|
34
34
|
from ansible.module_utils.compat.version import LooseVersion
|
|
35
|
-
from ansible.module_utils.six import string_types
|
|
36
35
|
from ansible.release import __version__ as ansible_version_raw
|
|
37
36
|
from ansible.utils.version import SemanticVersion
|
|
38
37
|
|
|
@@ -137,7 +136,7 @@ def _get_func_name(node):
|
|
|
137
136
|
def parse_isodate(value):
|
|
138
137
|
"""Parse an ISO 8601 date string."""
|
|
139
138
|
msg = 'Expected ISO 8601 date string (YYYY-MM-DD)'
|
|
140
|
-
if not isinstance(value,
|
|
139
|
+
if not isinstance(value, str):
|
|
141
140
|
raise ValueError(msg)
|
|
142
141
|
# From Python 3.7 in, there is datetime.date.fromisoformat(). For older versions,
|
|
143
142
|
# we have to do things manually.
|