ansible-core 2.16.5rc1__py3-none-any.whl → 2.17.0b1__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 +5 -27
- 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 +32 -25
- ansible/constants.py +41 -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 +10 -5
- 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 +2 -3
- 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 +2 -3
- 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 +3 -4
- 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 +63 -188
- 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 +25 -9
- 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 +14 -4
- 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 +2 -4
- 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 +6 -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 -2
- 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 +17 -6
- 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 +18 -8
- ansible/plugins/strategy/host_pinned.py +1 -3
- ansible/plugins/strategy/linear.py +23 -23
- 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 +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 +9 -29
- ansible/vars/manager.py +24 -6
- ansible/vars/reserved.py +1 -3
- {ansible_core-2.16.5rc1.data → ansible_core-2.17.0b1.data}/scripts/ansible-test +1 -2
- {ansible_core-2.16.5rc1.dist-info → ansible_core-2.17.0b1.dist-info}/METADATA +3 -3
- ansible_core-2.17.0b1.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/ansible_doc.py +1 -1
- 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 +58 -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.5rc1.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.5rc1.dist-info → ansible_core-2.17.0b1.dist-info}/COPYING +0 -0
- {ansible_core-2.16.5rc1.dist-info → ansible_core-2.17.0b1.dist-info}/WHEEL +0 -0
- {ansible_core-2.16.5rc1.dist-info → ansible_core-2.17.0b1.dist-info}/entry_points.txt +0 -0
- {ansible_core-2.16.5rc1.dist-info → ansible_core-2.17.0b1.dist-info}/top_level.txt +0 -0
|
@@ -70,13 +70,12 @@ from ansible.module_utils.common.collections import is_iterable
|
|
|
70
70
|
from ansible.module_utils.common.parameters import DEFAULT_TYPE_VALIDATORS
|
|
71
71
|
from ansible.module_utils.compat.version import StrictVersion, LooseVersion
|
|
72
72
|
from ansible.module_utils.basic import to_bytes
|
|
73
|
-
from ansible.module_utils.six import PY3, with_metaclass, string_types
|
|
74
73
|
from ansible.plugins.loader import fragment_loader
|
|
75
74
|
from ansible.plugins.list import IGNORE as REJECTLIST
|
|
76
75
|
from ansible.utils.plugin_docs import add_collection_to_versions_and_dates, add_fragments, get_docstring
|
|
77
76
|
from ansible.utils.version import SemanticVersion
|
|
78
77
|
|
|
79
|
-
from .module_args import AnsibleModuleImportError, AnsibleModuleNotInitialized,
|
|
78
|
+
from .module_args import AnsibleModuleImportError, AnsibleModuleNotInitialized, get_py_argument_spec, get_ps_argument_spec
|
|
80
79
|
|
|
81
80
|
from .schema import (
|
|
82
81
|
ansible_module_kwargs_schema,
|
|
@@ -87,18 +86,14 @@ from .schema import (
|
|
|
87
86
|
from .utils import CaptureStd, NoArgsAnsibleModule, compare_unordered_lists, parse_yaml, parse_isodate
|
|
88
87
|
|
|
89
88
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
REPLACER_WINDOWS = REPLACER_WINDOWS.decode('utf-8')
|
|
96
|
-
else:
|
|
97
|
-
TRY_EXCEPT = ast.TryExcept
|
|
89
|
+
# Because there is no ast.TryExcept in Python 3 ast module
|
|
90
|
+
TRY_EXCEPT = ast.Try
|
|
91
|
+
# REPLACER_WINDOWS from ansible.executor.module_common is byte
|
|
92
|
+
# string but we need unicode for Python 3
|
|
93
|
+
REPLACER_WINDOWS = REPLACER_WINDOWS.decode('utf-8')
|
|
98
94
|
|
|
99
95
|
REJECTLIST_DIRS = frozenset(('.git', 'test', '.github', '.idea'))
|
|
100
96
|
INDENT_REGEX = re.compile(r'([\t]*)')
|
|
101
|
-
TYPE_REGEX = re.compile(r'.*(if|or)(\s+[^"\']*|\s+)(?<!_)(?<!str\()type\([^)].*')
|
|
102
97
|
SYS_EXIT_REGEX = re.compile(r'[^#]*sys.exit\s*\(.*')
|
|
103
98
|
NO_LOG_REGEX = re.compile(r'(?:pass(?!ive)|secret|token|key)', re.I)
|
|
104
99
|
|
|
@@ -269,7 +264,7 @@ class Reporter:
|
|
|
269
264
|
return 3 if sum(ret) else 0
|
|
270
265
|
|
|
271
266
|
|
|
272
|
-
class Validator(
|
|
267
|
+
class Validator(metaclass=abc.ABCMeta):
|
|
273
268
|
"""Validator instances are intended to be run on a single object. if you
|
|
274
269
|
are scanning multiple objects for problems, you'll want to have a separate
|
|
275
270
|
Validator for each one."""
|
|
@@ -335,8 +330,6 @@ class ModuleValidator(Validator):
|
|
|
335
330
|
self.git_cache = git_cache
|
|
336
331
|
self.base_module = self.git_cache.get_original_path(self.path)
|
|
337
332
|
|
|
338
|
-
self._python_module_override = False
|
|
339
|
-
|
|
340
333
|
with open(path) as f:
|
|
341
334
|
self.text = f.read()
|
|
342
335
|
self.length = len(self.text.splitlines())
|
|
@@ -383,7 +376,7 @@ class ModuleValidator(Validator):
|
|
|
383
376
|
pass
|
|
384
377
|
|
|
385
378
|
def _python_module(self):
|
|
386
|
-
if self.path.endswith('.py')
|
|
379
|
+
if self.path.endswith('.py'):
|
|
387
380
|
return True
|
|
388
381
|
return False
|
|
389
382
|
|
|
@@ -421,7 +414,7 @@ class ModuleValidator(Validator):
|
|
|
421
414
|
return self.git_cache.is_new(self.path)
|
|
422
415
|
|
|
423
416
|
def _check_interpreter(self, powershell=False):
|
|
424
|
-
if
|
|
417
|
+
if self._powershell_module():
|
|
425
418
|
if not self.text.startswith('#!powershell\n'):
|
|
426
419
|
self.reporter.error(
|
|
427
420
|
path=self.object_path,
|
|
@@ -430,34 +423,20 @@ class ModuleValidator(Validator):
|
|
|
430
423
|
)
|
|
431
424
|
return
|
|
432
425
|
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
if not self.text.startswith('#!/usr/bin/python'):
|
|
436
|
-
if NEW_STYLE_PYTHON_MODULE_RE.search(to_bytes(self.text)):
|
|
437
|
-
missing_python_interpreter = self.text.startswith('#!') # shebang optional, but if present must match
|
|
438
|
-
else:
|
|
439
|
-
missing_python_interpreter = True # shebang required
|
|
426
|
+
if self._python_module():
|
|
427
|
+
missing_python_interpreter = False
|
|
440
428
|
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
)
|
|
429
|
+
if not self.text.startswith('#!/usr/bin/python'):
|
|
430
|
+
if NEW_STYLE_PYTHON_MODULE_RE.search(to_bytes(self.text)):
|
|
431
|
+
missing_python_interpreter = self.text.startswith('#!') # shebang optional, but if present must match
|
|
432
|
+
else:
|
|
433
|
+
missing_python_interpreter = True # shebang required
|
|
447
434
|
|
|
448
|
-
|
|
449
|
-
if powershell:
|
|
450
|
-
return
|
|
451
|
-
for line_no, line in enumerate(self.text.splitlines()):
|
|
452
|
-
typekeyword = TYPE_REGEX.match(line)
|
|
453
|
-
if typekeyword:
|
|
454
|
-
# TODO: add column
|
|
435
|
+
if missing_python_interpreter:
|
|
455
436
|
self.reporter.error(
|
|
456
437
|
path=self.object_path,
|
|
457
|
-
code='
|
|
458
|
-
msg=
|
|
459
|
-
'Use isinstance() instead'),
|
|
460
|
-
line=line_no + 1
|
|
438
|
+
code='missing-python-interpreter',
|
|
439
|
+
msg='Interpreter line is not "#!/usr/bin/python"',
|
|
461
440
|
)
|
|
462
441
|
|
|
463
442
|
def _check_for_sys_exit(self):
|
|
@@ -1120,14 +1099,6 @@ class ModuleValidator(Validator):
|
|
|
1120
1099
|
' documentation for removed'
|
|
1121
1100
|
)
|
|
1122
1101
|
else:
|
|
1123
|
-
# We are testing a collection
|
|
1124
|
-
if self.object_name.startswith('_'):
|
|
1125
|
-
self.reporter.error(
|
|
1126
|
-
path=self.object_path,
|
|
1127
|
-
code='collections-no-underscore-on-deprecation',
|
|
1128
|
-
msg='Deprecated content in collections MUST NOT start with "_", update meta/runtime.yml instead',
|
|
1129
|
-
)
|
|
1130
|
-
|
|
1131
1102
|
if not (doc_deprecated == routing_says_deprecated):
|
|
1132
1103
|
# DOCUMENTATION.deprecated and meta/runtime.yml disagree
|
|
1133
1104
|
self.reporter.error(
|
|
@@ -1193,7 +1164,7 @@ class ModuleValidator(Validator):
|
|
|
1193
1164
|
for entry in object:
|
|
1194
1165
|
self._validate_semantic_markup(entry)
|
|
1195
1166
|
return
|
|
1196
|
-
if not isinstance(object,
|
|
1167
|
+
if not isinstance(object, str):
|
|
1197
1168
|
return
|
|
1198
1169
|
|
|
1199
1170
|
if self.collection:
|
|
@@ -1312,7 +1283,12 @@ class ModuleValidator(Validator):
|
|
|
1312
1283
|
|
|
1313
1284
|
def _validate_ansible_module_call(self, docs):
|
|
1314
1285
|
try:
|
|
1315
|
-
|
|
1286
|
+
if self._python_module():
|
|
1287
|
+
spec, kwargs = get_py_argument_spec(self.path, self.collection)
|
|
1288
|
+
elif self._powershell_module():
|
|
1289
|
+
spec, kwargs = get_ps_argument_spec(self.path, self.collection)
|
|
1290
|
+
else:
|
|
1291
|
+
raise NotImplementedError()
|
|
1316
1292
|
except AnsibleModuleNotInitialized:
|
|
1317
1293
|
self.reporter.error(
|
|
1318
1294
|
path=self.object_path,
|
|
@@ -1374,7 +1350,7 @@ class ModuleValidator(Validator):
|
|
|
1374
1350
|
continue
|
|
1375
1351
|
bad_term = False
|
|
1376
1352
|
for term in check:
|
|
1377
|
-
if not isinstance(term,
|
|
1353
|
+
if not isinstance(term, str):
|
|
1378
1354
|
msg = name
|
|
1379
1355
|
if context:
|
|
1380
1356
|
msg += " found in %s" % " -> ".join(context)
|
|
@@ -1442,7 +1418,7 @@ class ModuleValidator(Validator):
|
|
|
1442
1418
|
continue
|
|
1443
1419
|
bad_term = False
|
|
1444
1420
|
for term in requirements:
|
|
1445
|
-
if not isinstance(term,
|
|
1421
|
+
if not isinstance(term, str):
|
|
1446
1422
|
msg = "required_if"
|
|
1447
1423
|
if context:
|
|
1448
1424
|
msg += " found in %s" % " -> ".join(context)
|
|
@@ -1525,13 +1501,13 @@ class ModuleValidator(Validator):
|
|
|
1525
1501
|
# This is already reported by schema checking
|
|
1526
1502
|
return
|
|
1527
1503
|
for key, value in terms.items():
|
|
1528
|
-
if isinstance(value,
|
|
1504
|
+
if isinstance(value, str):
|
|
1529
1505
|
value = [value]
|
|
1530
1506
|
if not isinstance(value, (list, tuple)):
|
|
1531
1507
|
# This is already reported by schema checking
|
|
1532
1508
|
continue
|
|
1533
1509
|
for term in value:
|
|
1534
|
-
if not isinstance(term,
|
|
1510
|
+
if not isinstance(term, str):
|
|
1535
1511
|
# This is already reported by schema checking
|
|
1536
1512
|
continue
|
|
1537
1513
|
if len(set(value)) != len(value) or key in value:
|
|
@@ -2268,7 +2244,6 @@ class ModuleValidator(Validator):
|
|
|
2268
2244
|
'extension for python modules or a .ps1 '
|
|
2269
2245
|
'for powershell modules')
|
|
2270
2246
|
)
|
|
2271
|
-
self._python_module_override = True
|
|
2272
2247
|
|
|
2273
2248
|
if self._python_module() and self.ast is None:
|
|
2274
2249
|
self.reporter.error(
|
|
@@ -2380,10 +2355,7 @@ class ModuleValidator(Validator):
|
|
|
2380
2355
|
self._check_gpl3_header()
|
|
2381
2356
|
if not self._just_docs() and not self._sidecar_doc() and not end_of_deprecation_should_be_removed_only:
|
|
2382
2357
|
if self.plugin_type == 'module':
|
|
2383
|
-
self._check_interpreter(
|
|
2384
|
-
self._check_type_instead_of_isinstance(
|
|
2385
|
-
powershell=self._powershell_module()
|
|
2386
|
-
)
|
|
2358
|
+
self._check_interpreter()
|
|
2387
2359
|
|
|
2388
2360
|
|
|
2389
2361
|
class PythonPackageValidator(Validator):
|
|
@@ -167,10 +167,3 @@ def get_py_argument_spec(filename, collection):
|
|
|
167
167
|
return argument_spec, fake.kwargs
|
|
168
168
|
except (TypeError, IndexError):
|
|
169
169
|
return {}, {}
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
def get_argument_spec(filename, collection):
|
|
173
|
-
if filename.endswith('.py'):
|
|
174
|
-
return get_py_argument_spec(filename, collection)
|
|
175
|
-
else:
|
|
176
|
-
return get_ps_argument_spec(filename, collection)
|
|
@@ -297,6 +297,7 @@ def argument_spec_schema(for_collection):
|
|
|
297
297
|
[is_callable, list_string_types],
|
|
298
298
|
),
|
|
299
299
|
'choices': Any([object], (object,)),
|
|
300
|
+
'context': dict,
|
|
300
301
|
'required': bool,
|
|
301
302
|
'no_log': bool,
|
|
302
303
|
'aliases': Any(list_string_types, tuple(list_string_types)),
|
|
@@ -487,10 +488,17 @@ def check_option_choices(v):
|
|
|
487
488
|
type_checker, type_name = get_type_checker({'type': v.get('elements')})
|
|
488
489
|
else:
|
|
489
490
|
type_checker, type_name = get_type_checker(v)
|
|
491
|
+
|
|
490
492
|
if type_checker is None:
|
|
491
493
|
return v
|
|
492
494
|
|
|
493
|
-
|
|
495
|
+
if isinstance(v_choices, dict):
|
|
496
|
+
# choices are still a list (the keys) but dict form serves to document each choice.
|
|
497
|
+
iterate = v_choices.keys()
|
|
498
|
+
else:
|
|
499
|
+
iterate = v_choices
|
|
500
|
+
|
|
501
|
+
for value in iterate:
|
|
494
502
|
try:
|
|
495
503
|
type_checker(value)
|
|
496
504
|
except Exception as exc:
|
|
@@ -542,7 +550,7 @@ def list_dict_option_schema(for_collection, plugin_type):
|
|
|
542
550
|
basic_option_schema = {
|
|
543
551
|
Required('description'): doc_string_or_strings,
|
|
544
552
|
'required': bool,
|
|
545
|
-
'choices': list,
|
|
553
|
+
'choices': Any(list, {object: doc_string_or_strings}),
|
|
546
554
|
'aliases': Any(list_string_types),
|
|
547
555
|
'version_added': version(for_collection),
|
|
548
556
|
'version_added_collection': collection_name,
|
|
@@ -192,7 +192,7 @@ def compare_unordered_lists(a, b):
|
|
|
192
192
|
- unordered lists
|
|
193
193
|
- unhashable elements
|
|
194
194
|
"""
|
|
195
|
-
return len(a) == len(b) and all(x in b for x in a)
|
|
195
|
+
return len(a) == len(b) and all(x in b for x in a) and all(x in a for x in b)
|
|
196
196
|
|
|
197
197
|
|
|
198
198
|
class NoArgsAnsibleModule(AnsibleModule):
|
|
@@ -126,19 +126,31 @@ class YamlChecker:
|
|
|
126
126
|
yaml_data = yaml_data[1:]
|
|
127
127
|
lineno += 1
|
|
128
128
|
|
|
129
|
-
|
|
129
|
+
multiple_docs_allowed = [
|
|
130
|
+
"EXAMPLES",
|
|
131
|
+
]
|
|
132
|
+
self.check_parsable(path, yaml_data, lineno, (key in multiple_docs_allowed), key)
|
|
130
133
|
|
|
131
134
|
messages = list(linter.run(yaml_data, conf, path))
|
|
132
135
|
|
|
133
136
|
self.messages += [self.result_to_message(r, path, lineno - 1, key) for r in messages]
|
|
134
137
|
|
|
135
|
-
def check_parsable(self, path, contents, lineno=1): # type: (str, str, int) -> None
|
|
138
|
+
def check_parsable(self, path, contents, lineno=1, allow_multiple=False, prefix=""): # type: (str, str, int, bool) -> None
|
|
136
139
|
"""Check the given contents to verify they can be parsed as YAML."""
|
|
140
|
+
prefix = f"{prefix}: " if prefix else ""
|
|
137
141
|
try:
|
|
138
|
-
yaml.
|
|
142
|
+
documents = len(list(yaml.load_all(contents, Loader=TestLoader)))
|
|
143
|
+
if documents > 1 and not allow_multiple:
|
|
144
|
+
self.messages += [{'code': 'multiple-yaml-documents',
|
|
145
|
+
'message': f'{prefix}expected a single document in the stream',
|
|
146
|
+
'path': path,
|
|
147
|
+
'line': lineno,
|
|
148
|
+
'column': 1,
|
|
149
|
+
'level': 'error',
|
|
150
|
+
}]
|
|
139
151
|
except MarkedYAMLError as ex:
|
|
140
152
|
self.messages += [{'code': 'unparsable-with-libyaml',
|
|
141
|
-
'message': '
|
|
153
|
+
'message': f'{prefix}{ex.args[0]} - {ex.args[2]}',
|
|
142
154
|
'path': path,
|
|
143
155
|
'line': ex.problem_mark.line + lineno,
|
|
144
156
|
'column': ex.problem_mark.column + 1,
|
|
@@ -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.
|
|
@@ -4,8 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
# NOTE: This file resides in the _util/target directory to ensure compatibility with all supported Python versions.
|
|
6
6
|
|
|
7
|
-
from __future__ import
|
|
8
|
-
__metaclass__ = type
|
|
7
|
+
from __future__ import annotations
|
|
9
8
|
|
|
10
9
|
import os
|
|
11
10
|
import sys
|
|
@@ -2,12 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
# NOTE: This file resides in the _util/target directory to ensure compatibility with all supported Python versions.
|
|
4
4
|
|
|
5
|
-
from __future__ import
|
|
6
|
-
__metaclass__ = type
|
|
5
|
+
from __future__ import annotations
|
|
7
6
|
|
|
8
7
|
REMOTE_ONLY_PYTHON_VERSIONS = (
|
|
9
|
-
'2.7',
|
|
10
|
-
'3.6',
|
|
11
8
|
'3.7',
|
|
12
9
|
'3.8',
|
|
13
10
|
'3.9',
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# auto-shebang
|
|
2
2
|
"""Provides an entry point for python scripts and python modules on the controller with the current python interpreter and optional code coverage collection."""
|
|
3
|
-
from __future__ import
|
|
4
|
-
__metaclass__ = type
|
|
3
|
+
from __future__ import annotations
|
|
5
4
|
|
|
5
|
+
import importlib.util
|
|
6
6
|
import os
|
|
7
7
|
import sys
|
|
8
8
|
|
|
@@ -19,22 +19,7 @@ def main():
|
|
|
19
19
|
if coverage_output:
|
|
20
20
|
args += ['-m', 'coverage.__main__', 'run', '--rcfile', coverage_config]
|
|
21
21
|
else:
|
|
22
|
-
|
|
23
|
-
# noinspection PyUnresolvedReferences
|
|
24
|
-
import importlib.util
|
|
25
|
-
|
|
26
|
-
# noinspection PyUnresolvedReferences
|
|
27
|
-
found = bool(importlib.util.find_spec('coverage'))
|
|
28
|
-
else:
|
|
29
|
-
# noinspection PyDeprecation
|
|
30
|
-
import imp
|
|
31
|
-
|
|
32
|
-
try:
|
|
33
|
-
# noinspection PyDeprecation
|
|
34
|
-
imp.find_module('coverage')
|
|
35
|
-
found = True
|
|
36
|
-
except ImportError:
|
|
37
|
-
found = False
|
|
22
|
+
found = bool(importlib.util.find_spec('coverage'))
|
|
38
23
|
|
|
39
24
|
if not found:
|
|
40
25
|
sys.exit('ERROR: Could not find `coverage` module. '
|
|
@@ -62,7 +47,7 @@ def find_program(name, executable): # type: (str, bool) -> str
|
|
|
62
47
|
Raises an exception if the program is not found.
|
|
63
48
|
"""
|
|
64
49
|
path = os.environ.get('PATH', os.path.defpath)
|
|
65
|
-
seen =
|
|
50
|
+
seen = {os.path.abspath(__file__)}
|
|
66
51
|
mode = os.F_OK | os.X_OK if executable else os.F_OK
|
|
67
52
|
|
|
68
53
|
for base in path.split(os.path.pathsep):
|
|
@@ -4,21 +4,14 @@
|
|
|
4
4
|
# https://github.com/pytest-dev/pytest-forked
|
|
5
5
|
# https://github.com/pytest-dev/py
|
|
6
6
|
# TIP: Disable pytest-xdist when debugging internal errors in this plugin.
|
|
7
|
-
from __future__ import
|
|
8
|
-
|
|
9
|
-
__metaclass__ = type
|
|
7
|
+
from __future__ import annotations
|
|
10
8
|
|
|
11
9
|
import os
|
|
12
10
|
import pickle
|
|
13
11
|
import tempfile
|
|
14
12
|
import warnings
|
|
15
13
|
|
|
16
|
-
from pytest import Item, hookimpl
|
|
17
|
-
|
|
18
|
-
try:
|
|
19
|
-
from pytest import TestReport
|
|
20
|
-
except ImportError:
|
|
21
|
-
from _pytest.runner import TestReport # Backwards compatibility with pytest < 7. Remove once Python 2.7 is not supported.
|
|
14
|
+
from pytest import Item, hookimpl, TestReport
|
|
22
15
|
|
|
23
16
|
from _pytest.runner import runtestprotocol
|
|
24
17
|
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
"""Enable unit testing of Ansible collections. PYTEST_DONT_REWRITE"""
|
|
2
|
-
from __future__ import
|
|
3
|
-
__metaclass__ = type
|
|
2
|
+
from __future__ import annotations
|
|
4
3
|
|
|
5
4
|
import os
|
|
6
5
|
|
|
@@ -39,9 +38,6 @@ def enable_assertion_rewriting_hook(): # type: () -> None
|
|
|
39
38
|
"""
|
|
40
39
|
import sys
|
|
41
40
|
|
|
42
|
-
if sys.version_info[0] == 2:
|
|
43
|
-
return # Python 2.x is not supported
|
|
44
|
-
|
|
45
41
|
hook_name = '_pytest.assertion.rewrite.AssertionRewritingHook'
|
|
46
42
|
hooks = [hook for hook in sys.meta_path if hook.__class__.__module__ + '.' + hook.__class__.__qualname__ == hook_name]
|
|
47
43
|
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
"""Monkey patch os._exit when running under coverage so we don't lose coverage data in forks, such as with `pytest --boxed`. PYTEST_DONT_REWRITE"""
|
|
2
|
-
from __future__ import
|
|
3
|
-
__metaclass__ = type
|
|
2
|
+
from __future__ import annotations
|
|
4
3
|
|
|
5
4
|
|
|
6
5
|
def pytest_configure():
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
"""Python syntax checker with lint friendly output."""
|
|
2
|
-
from __future__ import
|
|
3
|
-
__metaclass__ = type
|
|
2
|
+
from __future__ import annotations
|
|
4
3
|
|
|
5
4
|
import sys
|
|
6
5
|
|
|
7
6
|
ENCODING = 'utf-8'
|
|
8
7
|
ERRORS = 'replace'
|
|
9
|
-
Text = type(u'')
|
|
10
8
|
|
|
11
9
|
|
|
12
10
|
def main():
|
|
@@ -29,21 +27,14 @@ def compile_source(path):
|
|
|
29
27
|
else:
|
|
30
28
|
return
|
|
31
29
|
|
|
32
|
-
# In some situations offset can be None. This can happen for syntax errors on Python 2.6
|
|
33
|
-
# (__future__ import following after a regular import).
|
|
34
|
-
offset = offset or 0
|
|
35
|
-
|
|
36
30
|
result = "%s:%d:%d: %s: %s" % (path, lineno, offset, extype.__name__, safe_message(message))
|
|
37
31
|
|
|
38
|
-
if sys.version_info <= (3,):
|
|
39
|
-
result = result.encode(ENCODING, ERRORS)
|
|
40
|
-
|
|
41
32
|
print(result)
|
|
42
33
|
|
|
43
34
|
|
|
44
35
|
def safe_message(value):
|
|
45
|
-
"""Given an input value as
|
|
46
|
-
if isinstance(value,
|
|
36
|
+
"""Given an input value as str or bytes, return the first non-empty line as str, ensuring it can be round-tripped as UTF-8."""
|
|
37
|
+
if isinstance(value, str):
|
|
47
38
|
value = value.encode(ENCODING, ERRORS)
|
|
48
39
|
|
|
49
40
|
value = value.decode(ENCODING, ERRORS)
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
"""Import the given python module(s) and report error(s) encountered."""
|
|
2
|
-
from __future__ import
|
|
3
|
-
__metaclass__ = type
|
|
2
|
+
from __future__ import annotations
|
|
4
3
|
|
|
5
4
|
|
|
6
5
|
def main():
|
|
@@ -542,16 +541,6 @@ def main():
|
|
|
542
541
|
"ignore",
|
|
543
542
|
"AnsibleCollectionFinder has already been configured")
|
|
544
543
|
|
|
545
|
-
if sys.version_info[0] == 2:
|
|
546
|
-
warnings.filterwarnings(
|
|
547
|
-
"ignore",
|
|
548
|
-
"Python 2 is no longer supported by the Python core team. Support for it is now deprecated in cryptography,"
|
|
549
|
-
" and will be removed in a future release.")
|
|
550
|
-
warnings.filterwarnings(
|
|
551
|
-
"ignore",
|
|
552
|
-
"Python 2 is no longer supported by the Python core team. Support for it is now deprecated in cryptography,"
|
|
553
|
-
" and will be removed in the next release.")
|
|
554
|
-
|
|
555
544
|
# ansible.utils.unsafe_proxy attempts patching sys.intern generating a warning if it was already patched
|
|
556
545
|
warnings.filterwarnings(
|
|
557
546
|
"ignore",
|