Compare commits

...

10 Commits

Author SHA1 Message Date
f27a4a4f5c New release v2.15.0b2 (#80467) 2023-04-10 16:01:01 -05:00
3a378ba61b ansible-test - Update default containers (#80466) 2023-04-10 13:25:41 -07:00
c7603bbb72 [stable-2.15] Replace validate-modules's semantic markup parser with antsibull-docs-parser (#80406) (#80432)
(cherry picked from commit 92c694372b)

Co-authored-by: Felix Fontein <felix@fontein.de>
2023-04-07 10:04:32 -07:00
8f0ddcba2c dnf5: fix module/pkg names in the failed respawn msg (#80402) (#80434)
(cherry picked from commit 12ce7d2e4e)
2023-04-06 13:19:40 -05:00
856e0312ff dnf5: use the logs API to determine transaction problems (#80401) (#80433)
(cherry picked from commit 8d5c250234)
2023-04-06 13:19:27 -05:00
13cdec1f46 [stable-2.15] Extend ansible-doc test with more classic markup. (#80407) (#80431)
(cherry picked from commit 96f7fd5539)

Co-authored-by: Felix Fontein <felix@fontein.de>
2023-04-06 09:58:49 -07:00
66ef54e83f [stable-2.15] Only use the selectors code path when we are prompt matching (#79931) (#80400)
(cherry picked from commit 6d1e355)
2023-04-05 11:06:28 -05:00
4fcf731ced Fetch signatures from galaxy after the dependency resolver runs (#80334) (#80397)
Reduce the number of Galaxy API calls made during dependency resolution by fetching remote signatures afterwards, since these are not used in backtracking.

Reduce the verbosity to `-vvvv` (to match other Galaxy API calls) to see this activity.

Co-authored-by: Sviatoslav Sydorenko <webknjaz@redhat.com>
(cherry picked from commit 460abe0cef)
2023-04-05 11:06:13 -05:00
ca08c27c94 Update Ansible release version to v2.15.0b1.post0. (#80396) 2023-04-04 13:29:32 -05:00
5a262ab510 New release v2.15.0b1 (#80395) 2023-04-04 12:41:20 -05:00
29 changed files with 1327 additions and 236 deletions

View File

@ -0,0 +1,340 @@
================================================
ansible-core 2.15 "Ten Years Gone" Release Notes
================================================
.. contents:: Topics
v2.15.0b2
=========
Release Summary
---------------
| Release Date: 2023-04-10
| `Porting Guide <https://docs.ansible.com/ansible-core/2.15/porting_guides/porting_guide_core_2.15.html>`__
Bugfixes
--------
- AnsibleModule.run_command - Only use selectors when needed, and rely on Python stdlib subprocess for the simple task of collecting stdout/stderr when prompt matching is not required.
- ansible-galaxy - reduce API calls to servers by fetching signatures only for final candidates.
- dnf5 - fix module and package names in the message following failed module respawn attempt
- dnf5 - use the logs API to determine transaction problems
- validate-modules sanity test - replace semantic markup parsing and validating code with the code from `antsibull-docs-parser 0.2.0 <https://github.com/ansible-community/antsibull-docs-parser/releases/tag/0.2.0>`__ (https://github.com/ansible/ansible/pull/80406).
v2.15.0b1
=========
Release Summary
---------------
| Release Date: 2023-04-04
| `Porting Guide <https://docs.ansible.com/ansible-core/2.15/porting_guides/porting_guide_core_2.15.html>`__
Major Changes
-------------
- ansible-test - Docker Desktop on WSL2 is now supported (additional configuration required).
- ansible-test - Docker and Podman are now supported on hosts with cgroup v2 unified. Previously only cgroup v1 and cgroup v2 hybrid were supported.
- ansible-test - Podman now works on container hosts without systemd. Previously only some containers worked, while others required rootfull or rootless Podman, but would not work with both. Some containers did not work at all.
- ansible-test - Podman on WSL2 is now supported.
- ansible-test - When additional cgroup setup is required on the container host, this will be automatically detected. Instructions on how to configure the host will be provided in the error message shown.
Minor Changes
-------------
- Add support for custom salt for vault encoding to make it deterministic (https://github.com/ansible/ansible/issues/35480).
- Added the conditional that was False if ``when`` caused a task to skip under ``false_condition``.
- Allow force deletion of a group even when it is the primary group of a user. (https://github.com/ansible/ansible/issues/77849)
- Ansible.ModuleUtils.AddType - Add support for compiling ``unsafe`` code with the ``//AllowUnsafe`` directive
- Cache field attributes list on the playbook classes
- Cleaned up unused imports in core.
- Get user input for ``pause`` and ``paramiko_ssh`` from the strategy rather than access ``sys.stdin`` in the WorkerProcess.
- Introduce ``Delegatable`` and ``Notifiable`` mixin classes for playbook objects
- Make using blocks as handlers a parser error (https://github.com/ansible/ansible/issues/79968)
- Playbook objects - Replace deprecated stacked ``@classmethod`` and ``@property``
- Raise an error when an incorrect ``isa`` type is passed to ``FieldAttribute``.
- Remove fallback code for when ``defined``/``undefined`` tests were used on objects containing nested undefined variables; due to changes in lazy evalution of Jinja2 expressions it is no longer needed.
- Remove unused Python stdlib imports from module_utils which were not present for backwards compatibility in: common.file, compat.selectors, facts.network.iscsi, facts.network.nvme, yumdnf
- Remove unused internal imports from module_utils which were not present for backwards compatibility in: common.file, common.parameters, facts.system.caps, yumdnf
- Removed ``straight.plugin`` from the build and packaging requirements.
- Removed unused imports from the following action plugins: async_status, command, pause, set_stats, uri, validate_argument_spec
- Removed unused imports from the following lookup plugins: fileglob, template
- Removed unused imports from the following modules: apt, dnf, expect, pip, slurp, user, yum
- Removed unused imports from the following set of test plugins: files
- Removed unused imports from the following strategy plugins: debug
- Removed unused imports from the following vars plugins: host_group_vars
- Use ``ansible.module_utils.six.moves.collections_abc`` instead of ``ansible.module_utils.common._collections_compat`` in modules and module_utils.
- Use ``collections.abc`` instead of ``ansible.module_utils.common._collections_compat`` in controller code.
- ``AnsibleJ2Vars`` class that acts as a storage for all variables for templating purposes now uses ``collections.ChainMap`` internally.
- add parameter ``numeric`` to the iptables module to disable dns lookups when running list -action internally (https://github.com/ansible/ansible/issues/78793).
- allow user to set ansible specific env vars for selecting pager and editor, but still fall back to commonly used defaults.
- ansible-doc - support role extension for semantic markup spec so that ``O()`` and ``RV()`` referring to role entrypoints are rendered more readable (https://github.com/ansible/ansible/pull/80305).
- ansible-doc - support semantic markup in text output (https://github.com/ansible/ansible/pull/80242).
- ansible-doc text output - support ``seealso`` plugin record that was added for filter and test plugin documentation (https://github.com/ansible/ansible/pull/80212).
- ansible-galaxy - Add ability to specify collection versions on the CLI without the need for a colon. Such as ``namespace.name==1.2.3`` vs ``namespace.name:1.2.3``.
- ansible-galaxy - Use Python's native ``raise ... from`` instead of ``six.raise_from``.
- ansible-galaxy - support ``resolvelib >= 0.5.3, < 0.10.0``.
- ansible-galaxy - support ``resolvelib >= 0.5.3, < 1.1.0``.
- ansible-inventory now supports the limit command line options.
- ansible-test - A new ``audit`` option is available when running custom containers. This option can be used to indicate whether a container requires the AUDIT_WRITE capability. The default is ``required``, which most containers will need when using Podman. If necessary, the ``none`` option can be used to opt-out of the capability. This has no effect on Docker, which always provides the capability.
- ansible-test - A new ``cgroup`` option is available when running custom containers. This option can be used to indicate a container requires cgroup v1 or that it does not use cgroup. The default behavior assumes the container works with cgroup v2 (as well as v1).
- ansible-test - Add Alpine 3.17 remote.
- ansible-test - Add Fedora 37 container.
- ansible-test - Add Fedora 37 remote.
- ansible-test - Add FreeBSD 12.4 remote.
- ansible-test - Add RHEL 8.7 remote.
- ansible-test - Add RHEL 9.1 remote.
- ansible-test - Add macOS 13.2 remote.
- ansible-test - Additional log details are shown when containers fail to start or SSH connections to containers fail.
- ansible-test - Connection failures to remote provisioned hosts now show failure details as a warning.
- ansible-test - Containers included with ansible-test no longer disable seccomp by default.
- ansible-test - Disabled the ``ansible-format-automatic-specification`` rule from the ``pylint`` sanity test, now that Python 2.6 is no longer supported.
- ansible-test - Enable the ``trailing-comma-tuple`` rule in the ``pylint`` sanity test.
- ansible-test - Enable the ``unused-import`` rule for the ``pylint`` sanity test for collections.
- ansible-test - Failure to connect to a container over SSH now results in a clear error. Previously tests would be attempted even after initial connection attempts failed.
- ansible-test - Improve consistency of executed ``pylint`` commands by making the plugins ordered.
- ansible-test - Improve consistency of version specific documentation links.
- ansible-test - Integration tests can be excluded from retries triggered by the ``--retry-on-error`` option by adding the ``retry/never`` alias. This is useful for tests that cannot pass on a retry or are too slow to make retries useful.
- ansible-test - Minor cleanup and package updates in distro containers.
- ansible-test - More details are provided about an instance when provisioning fails.
- ansible-test - Moved git handling out of the validate-modules sanity test and into ansible-test.
- ansible-test - Reduce the polling limit for SSHD startup in containers from 60 retries to 10. The one second delay between retries remains in place.
- ansible-test - Removed test containers: fedora36
- ansible-test - Removed test remotes: alpine/3.16, fedora/36, freebsd/12.3, rhel/8.6, rhel/9.0, macos/12.0
- ansible-test - Removed the ``--keep-git`` sanity test option, which was limited to testing ansible-core itself.
- ansible-test - SSH connections from OpenSSH 8.8+ to CentOS 6 containers now work without additional configuration. However, clients older than OpenSSH 7.0 can no longer connect to CentOS 6 containers as a result. The container must have ``centos6`` in the image name for this work-around to be applied.
- ansible-test - SSH shell connections from OpenSSH 8.8+ to ansible-test provisioned network instances now work without additional configuration. However, clients older than OpenSSH 7.0 can no longer open shell sessions for ansible-test provisioned network instances as a result.
- ansible-test - Specify the configuration file location required by test plugins when the config file is not found. This resolves issue: https://github.com/ansible/ansible/issues/79411
- ansible-test - The ``ansible-test env`` command now detects and reports the container ID if running in a container.
- ansible-test - The ``pep8`` sanity test rule ``E203`` is now disabled since it is not PEP 8 compliant. This provides compatibility with output generated by the ``black`` code formatter.
- ansible-test - The ``validate-modules`` sanity test no longer limits the ``__future__`` imports that can be used. Other sanity tests that check ``__future__`` imports remain unchanged. As a result, the error code ``illegal-future-imports`` is no longer used.
- ansible-test - Unit tests now support network disconnect by default when running under Podman. Previously this feature only worked by default under Docker.
- ansible-test - Update Alpine 3 container to 3.17.
- ansible-test - Update Python requirements used for sanity tests.
- ansible-test - Update ``base`` and ``default`` containers to include Python 3.11.0.
- ansible-test - Update ``default`` containers to include new ``docs-build`` sanity test requirements.
- ansible-test - Update error handling code to use Python 3.x constructs, avoiding direct use of ``errno``.
- ansible-test - Update test container to ``7.4.0`` which includes the new PSScriptAnalyzer versions
- ansible-test - Update the CloudStack test plugin to use a newer test container with CloudStack 4.18.0.
- ansible-test - Update the NIOS test plugin to use a newer multi-arch test container.
- ansible-test - Update the ``ansible-bad-import-from`` rule in the ``pylint`` sanity test to recommend ``ansible.module_utils.six.moves.collections_abc`` instead of ``ansible.module_utils.common._collections_compat``.
- ansible-test - Update the ``base`` and ``default`` test containers with the latest requirements.
- ansible-test - Updated the Azure Pipelines CI plugin to work with newer versions of git.
- ansible-test - Use ``stop --time 0`` followed by ``rm`` to remove ephemeral containers instead of ``rm -f``. This speeds up teardown of ephemeral containers.
- ansible-test - Warnings are now shown when using containers that were built with VOLUME instructions.
- ansible-test - When setting the max open files for containers, the container host's limit will be checked. If the host limit is lower than the preferred value, it will be used and a warning will be shown.
- ansible-test - When using Podman, ansible-test will detect if the loginuid used in containers is incorrect. When this occurs a warning is displayed and the container is run with the AUDIT_CONTROL capability. Previously containers would fail under this situation, with no useful warnings or errors given.
- ansible-test acme test container - update version to update used Pebble version, underlying Python and Go base containers, and Python requirements (https://github.com/ansible/ansible/pull/79783).
- ansible-test pslint - Upgrade PSScriptAnalyzer to ``1.21.0`` which enables the ``AvoidMultipleTypeAttributes``, ``AvoidSemicolonsAsLineTerminators``, and ``AvoidUsingBrokenHashAlgorithms`` rules
- ansible-test runtime-metadata sanity test - ensure that ``redirect`` entries in ``meta/runtime.yml`` contain collection names, except for ``module_utils`` plugin redirects and ``import_redirect`` redirects (https://github.com/ansible/ansible/pull/78802).
- ansible-test sanity --test ansible-doc - now also lists documentation for test and filter plugins that are documented (https://github.com/ansible/ansible/pull/77737).
- ansible-test validate-modules - Added support for validating module documentation stored in a sidecar file alongside the module (``{module}.yml`` or ``{module}.yaml``). Previously these files were ignored and documentation had to be placed in ``{module}.py``.
- ansible-test validate-modules - no longer treat falsy non-``False`` values for defaults as ``None`` (https://github.com/ansible/ansible/pull/79267).
- apt - add allow-change-held-packages option to apt remove (https://github.com/ansible/ansible/issues/78131)
- apt_repository - adds ``sources_added`` and ``sources_removed`` to the return of the module (https://github.com/ansible/ansible/issues/79306).
- apt_repository will use the trust repo directories in order of preference (more appropriate to less) as they exist on the target.
- collections - Add additional ignores for commonly rejected file extensions
- collections - Add additional includes for REUSE license files (https://github.com/ansible/ansible/issues/79368)
- deb822_repository - Add new module for managing DEB822 formatted apt repositories
- debug - Perform argspec valdiation in debug action plugin (https://github.com/ansible/ansible/issues/79862)
- dnf5 - Add new module for managing packages and other artifacts via the next version of DNF (https://github.com/ansible/ansible/issues/78898)
- galaxy - include ``license_file`` in the default manifest directives (https://github.com/ansible/ansible/pull-request/79420)
- optimized var loading by caching results as there is no variance in input during run.
- pycompat24 module_utils - Remove support for Python 2.5 and earlier.
- sanity tests - updates the collection-deprecated-version tests to ignore the ``prerelease`` component of the collection version ().
- strftime filter, additional docs and links to source of truth.
- updated the vendored distro library to upstream version (https://github.com/ansible/ansible/pull/79227)
- validate-modules sanity test - add support for semantic markup (https://github.com/ansible/ansible/pull/80243).
- validate-modules sanity test - if the ``check_mode`` attribute is present, check that it coincides with the ``support_check_mode`` parameter of ``AnsibleModule`` (https://github.com/ansible/ansible/pull/80090).
- validate-modules sanity test - remove support for the never implemented ``forced_action_plugin`` attribute (https://github.com/ansible/ansible/pull/79317).
- validate-modules sanity test - support the ``plugin`` see-also part of the semantic markup specification (https://github.com/ansible/ansible/pull/80244).
Breaking Changes / Porting Guide
--------------------------------
- ansible-doc - no longer treat plugins in collections whose name starts with ``_`` as deprecated (https://github.com/ansible/ansible/pull/79217).
- ansible-test - Integration tests which depend on specific file permissions when running in an ansible-test managed host environment may require changes. Tests that require permissions other than ``755`` or ``644`` may need to be updated to set the necessary permissions as part of the test run.
- ansible-test - The ``vcenter`` test plugin now defaults to using a user-provided static configuration instead of the ``govcsim`` simulator for collections. Set the ``ANSIBLE_VCSIM_CONTAINER`` environment variable to ``govcsim`` to use the simulator. Keep in mind that the simulator is deprecated and will be removed in a future release.
- ansible-test sanity - previously plugins and modules in collections whose name started with ``_`` were treated as deprecated, even when they were not marked as deprecated in ``meta/runtime.yml``. This is no longer the case (https://github.com/ansible/ansible/pull/79362).
- ansible-test validate-modules - Removed the ``missing-python-doc`` error code in validate modules, ``missing-documentation`` is used instead for missing PowerShell module documentation.
Deprecated Features
-------------------
- The ``ConnectionBase()._new_stdin`` attribute is deprecated, use ``display.prompt_until(msg)`` instead.
- ansible-test - The ``foreman`` test plugin is now deprecated. It will be removed in a future release.
- ansible-test - The ``govcsim`` simulator in the ``vcenter`` test plugin is now deprecated. It will be removed in a future release. Users should switch to providing their own test environment through a static configuration file.
- password_hash - deprecate using passlib.hash.hashtype if hashtype isn't in the list of documented choices.
- vars - Specifying a list of dictionaries for ``vars:`` is deprecated in favor of specifying a dictionary.
Removed Features (previously deprecated)
----------------------------------------
- Remove deprecated ``ANSIBLE_CALLBACK_WHITELIST`` configuration environment variable, use ``ANSIBLE_CALLBACKS_ENABLED`` instead. (https://github.com/ansible/ansible/issues/78821)
- Remove deprecated ``ANSIBLE_COW_WHITELIST`` configuration environment variable, use ``ANSIBLE_COW_ACCEPTLIST`` instead. (https://github.com/ansible/ansible/issues/78819)
- Remove deprecated ``callback_whitelist`` configuration option, use ``callbacks_enabled`` instead. (https://github.com/ansible/ansible/issues/78822)
- Remove deprecated ``cow_whitelist`` configuration option, use ``cowsay_enabled_stencils`` instead. (https://github.com/ansible/ansible/issues/78820)
Bugfixes
--------
- Ansible.Basic.cs - Ignore compiler warning (reported as an error) when running under PowerShell 7.3.x.
- BSD network facts - Do not assume column indexes, look for ``netmask`` and ``broadcast`` for determining the correct columns when parsing ``inet`` line (https://github.com/ansible/ansible/issues/79117)
- Correctly count rescued tasks in play recap (https://github.com/ansible/ansible/issues/79711)
- Do not crash when templating an expression with a test or filter that is not a valid Ansible filter name (https://github.com/ansible/ansible/issues/78912, https://github.com/ansible/ansible/pull/78913).
- Fix ``MANIFEST.in`` to exclude unwanted files in the ``packaging/`` directory.
- Fix ``MANIFEST.in`` to include ``*.md`` files in the ``test/support/`` directory.
- Fix a traceback occuring when a task is named ``meta`` (https://github.com/ansible/ansible/issues/79459)
- Fix an issue where the value of ``become`` was ignored when used on a role used as a dependency in ``main/meta.yml`` (https://github.com/ansible/ansible/issues/79777)
- Fix bug in `vars` applied to roles, they were being incorrectly exported among others while only vars/main.yml was meant to be. Also adjusted the precedence to act the same as inline params.
- Fix conditionally notifying ``include_tasks` handlers when ``force_handlers`` is used (https://github.com/ansible/ansible/issues/79776)
- Fix reusing a connection in a task loop that uses a redirected or aliased name - https://github.com/ansible/ansible/issues/78425
- Fix setting become activation in a task loop - https://github.com/ansible/ansible/issues/78425
- Fix traceback when using the ``template`` module and running with ``ANSIBLE_DEBUG=1`` (https://github.com/ansible/ansible/issues/79763)
- Fix using ``GALAXY_IGNORE_CERTS`` in conjunction with collections in requirements files which specify a specific ``source`` that isn't in the configured servers.
- Fix using ``GALAXY_IGNORE_CERTS`` when downloading tarballs from Galaxy servers (https://github.com/ansible/ansible/issues/79557).
- Fixes leftover _valid_attrs usage.
- Fixes the password lookup to not rewrite files if they are not changed when using the "encrypt" parameter (#79430).
- Module and role argument validation - include the valid suboption choices in the error when an invalid suboption is provided.
- Perform type check on data passed to Display.display to enforce the requirement of being given a python3 unicode string
- TaskExecutor - don't ignore templated _raw_params that k=v parser failed to parse (https://github.com/ansible/ansible/issues/79862)
- Windows - Display a warning if the module failed to cleanup any temporary files rather than failing the task. The warning contains a brief description of what failed to be deleted.
- Windows - Ensure the module temp directory contains more unique values to avoid conflicts with concurrent runs - https://github.com/ansible/ansible/issues/80294
- Windows - Improve temporary file cleanup used by modules. Will use a more reliable delete operation on Windows Server 2016 and newer to delete files that might still be open by other software like Anti Virus scanners. There are still scenarios where a file or directory cannot be deleted but the new method should work in more scenarios.
- ``ansible-galaxy search rolename`` - give a warning instead of non-zero return code when search results are empty. This is similar to the behavior when listing roles, which gives a warning if a role cannot be found and exits with a return code of ``0``.
- ``ansible_eval_concat`` - avoid redundant unsafe wrapping of templated strings converted to Python types
- ansible-config limit shorthand format to assigned values
- ansible-doc - stop generating wrong module URLs for module see-alsos. The URLs for modules in ansible.builtin do now work, and URLs for modules outside ansible.builtin are no longer added (https://github.com/ansible/ansible/pull/80280).
- ansible-doc now will correctly display short descriptions on listing filters/tests no matter the directory sorting.
- ansible-galaxy - Improve retries for collection installs, to properly retry, and extend retry logic to common URL related connection errors (https://github.com/ansible/ansible/issues/80170 https://github.com/ansible/ansible/issues/80174)
- ansible-galaxy - fix installing collections in git repositories/directories which contain a MANIFEST.json file (https://github.com/ansible/ansible/issues/79796).
- ansible-galaxy - make initial call to Galaxy server on-demand only when installing, getting info about, and listing roles.
- ansible-galaxy collection install - respect symlinks when installing from source or local repository (https://github.com/ansible/ansible/issues/78442)
- ansible-galaxy collection/role init - preserve symlinks (https://github.com/ansible/ansible/issues/39334).
- ansible-galaxy role info - fix unhandled AttributeError by catching the correct exception.
- ansible-inventory will no longer duplicate host entries if they were part of a group's childrens tree.
- ansible-inventory will not explicitly sort groups/hosts anymore, giving a chance (depending on output format) to match the order in the input sources.
- ansible-playbook -K breaks when passwords have quotes (https://github.com/ansible/ansible/issues/79836).
- ansible-test - Add ``wheel < 0.38.0`` constraint for Python 3.6 and earlier.
- ansible-test - Add support for ``pytest`` assertion rewriting when running unit tests on Python 3.5 and later. Resolves issue https://github.com/ansible/ansible/issues/68032
- ansible-test - Added a work-around for a traceback under Python 3.11 when completing certain command line options.
- ansible-test - Allow disabled, unsupported, unstable and destructive integration test targets to be selected using their respective prefixes.
- ansible-test - Allow unstable tests to run when targeted changes are made and the ``--allow-unstable-changed`` option is specified (resolves https://github.com/ansible/ansible/issues/74213).
- ansible-test - Always indicate the Python version being used before installing requirements. Resolves issue https://github.com/ansible/ansible/issues/72855
- ansible-test - Avoid using ``exec`` after container startup when possible. This improves container startup performance and avoids intermittent startup issues with some old containers.
- ansible-test - Connection attempts to managed remote instances no longer abort on ``Permission denied`` errors.
- ansible-test - Detection for running in a Podman or Docker container has been fixed to detect more scenarios. The new detection relies on ``/proc/self/mountinfo`` instead of ``/proc/self/cpuset``. Detection now works with custom cgroups and private cgroup namespaces.
- ansible-test - Exclude ansible-core vendored Python packages from ansible-test payloads.
- ansible-test - Fix broken documentation link for ``aws`` test plugin error messages.
- ansible-test - Fix validate-modules error when retrieving PowerShell argspec when retrieved inside a Cmdlet
- ansible-test - Handle server errors when executing the ``docker info`` command.
- ansible-test - Integration test target prefixes defined in a ``tests/integration/target-prefixes.{group}`` file can now contain an underscore (``_``) character. Resolves issue https://github.com/ansible/ansible/issues/79225
- ansible-test - Multiple containers now work under Podman without specifying the ``--docker-network`` option.
- ansible-test - Pass the ``XDG_RUNTIME_DIR`` environment variable through to container commands.
- ansible-test - Perform PyPI proxy configuration after instances are ready and bootstrapping has been completed. Only target instances are affected, as controller instances were already handled this way. This avoids proxy configuration errors when target instances are not yet ready for use.
- ansible-test - Prevent concurrent / repeat inspections of the same container image.
- ansible-test - Prevent concurrent / repeat pulls of the same container image.
- ansible-test - Prevent concurrent execution of cached methods.
- ansible-test - Removed pointless comparison in diff evaluation logic.
- ansible-test - Set ``PYLINTHOME`` for the ``pylint`` sanity test to prevent failures due to ``pylint`` checking for the existence of an obsolete home directory.
- ansible-test - Show the exception type when reporting errors during instance provisioning.
- ansible-test - Support Podman 4.4.0+ by adding the ``SYS_CHROOT`` capability when running containers.
- ansible-test - Support loading of vendored Python packages from ansible-core.
- ansible-test - The ``validate-modules`` sanity test now properly enforces documentation before imports for plugins. Previously this was only enforced for modules due to a coding error.
- ansible-test - Update the ``pylint`` sanity test requirements to resolve crashes on Python 3.11. (https://github.com/ansible/ansible/issues/78882)
- ansible-test - Update the ``pylint`` sanity test to use version 2.15.4.
- ansible-test - Update the ``pylint`` sanity test to use version 2.15.5.
- ansible-test - Use consistent file permissions when delegating tests to a container or remote host. Files with any execute bit set will use permissions ``755``. All other files will use permissions ``644``. (Resolves issue https://github.com/ansible/ansible/issues/75079)
- ansible-test - fix warning message about failing to run an image to include the image name
- ansible-test runtime-metadata sanity test - do not crash on YAML parsing errors without a context mark (https://github.com/ansible/ansible/pull/78802).
- ansible-test sanity - correctly report invalid YAML in validate-modules (https://github.com/ansible/ansible/issues/75837).
- ansible-vault encrypt_string - started appending a line feed at the end of the encrypted string output. Missing newline character caused problems identifying where the string ends in some shells (like bash) or accidentally copying an extra trailing terminator symbol (e.g., zsh prints out a ``%`` sign to signal where the original output stops) (https://github.com/ansible/ansible/issues/78932).
- ansible_facts.hardware - Define all processor facts on s390x (https://github.com/ansible/ansible/issues/19755)
- apt - set locale to fix updating the cache (https://github.com/ansible/ansible/issues/79523).
- apt module should not traceback on invalid type given as package. issue 78663.
- apt_repository will no longer fail to detect key when unrelated errors/warnings are issued by apt-key.
- argument spec validation - again report deprecated parameters for Python-based modules. This was accidentally removed in ansible-core 2.11 when argument spec validation was refactored (https://github.com/ansible/ansible/issues/79680, https://github.com/ansible/ansible/pull/79681).
- argument spec validation - ensure that deprecated aliases in suboptions are also reported (https://github.com/ansible/ansible/pull/79740).
- argument spec validation - fix warning message when two aliases of the same option are used for suboptions to also mention the option's name they are in (https://github.com/ansible/ansible/pull/79740).
- basic.py module_utils - Perform Python version check much earlier to ensure it runs before other errors occur.
- connection local now avoids traceback on invalid user being used to execuet ansible (valid in host, but not in container).
- copy - fix creating the dest directory in check mode with remote_src=True (https://github.com/ansible/ansible/issues/78611).
- copy - fix reporting changes to file attributes in check mode with remote_src=True (https://github.com/ansible/ansible/issues/77957).
- copy module will no longer move 'non files' set as src when remote_src=true.
- copy remote_src=true - fix copying subdirs recursively when the dest exists and the src and dest have multiple common subdirectories in a common directory (https://github.com/ansible/ansible/issues/74536).
- copy remote_src=true - fix reporting changed for copying empty directories.
- display - reduce risk of post-fork output deadlocks (https://github.com/ansible/ansible/pull/79522)
- file - touch action in check mode was always returning ok. Fix now evaluates the different conditions and returns the appropriate changed status. (https://github.com/ansible/ansible/issues/79360)
- file lookup now handles missing files more gracefully.
- file lookup now plays nice with generic lookup ``errors`` option.
- get_url - Ensure we are passing ciphers to all url_get calls (https://github.com/ansible/ansible/issues/79717)
- get_url module - Added a documentation reference to ``hashlib`` regarding algorithms, as well as a note about ``md5`` support on systems running in FIPS compliant mode.
- get_url module - Removed out-of-date documentation stating that ``hashlib`` is a third-party library.
- handlers - fix an issue where the ``flush_handlers`` meta task could not be used with FQCN: ``ansible.builtin.meta`` (https://github.com/ansible/ansible/issues/79023)
- include_role - Inherit from role parents beyond a depth of 3 (https://github.com/ansible/ansible/issues/47023).
- jinja2_native - fix intermittent 'could not find job' failures when a value of ``ansible_job_id`` from a result of an async task was inadvertently changed during execution; to prevent this a format of ``ansible_job_id`` was changed.
- jinja2_native: preserve quotes in strings (https://github.com/ansible/ansible/issues/79083)
- keyword inheritance - Ensure that we do not squash keywords in validate (https://github.com/ansible/ansible/issues/79021)
- known_hosts - do not return changed status when a non-existing key is removed (https://github.com/ansible/ansible/issues/78598)
- list-tags now shows the 'never' tag, which was being excluded by default. To list all tasks you still need to add `--list-tasks --tags never,all`.
- loops/delegate_to - Do not double calculate the values of loops and ``delegate_to`` (https://github.com/ansible/ansible/issues/80038)
- module_utils/basic.py - Fix detection of available hashing algorithms on Python 3.x. All supported algorithms are now available instead of being limited to a hard-coded list. This affects modules such as ``get_url`` which accept an arbitrary checksum algorithm.
- normal action plugin - remove obsolete ``if`` (https://github.com/ansible/ansible/pull/79690).
- omit on keywords was resetting to default value, ignoring inheritance.
- paramiko - Add a new option to allow paramiko >= 2.9 to easily work with all devices now that rsa-sha2 support was added to paramiko, which prevented communication with numerous platforms. (https://github.com/ansible/ansible/issues/76737)
- paramiko - Add back support for ``ssh_args``, ``ssh_common_args``, and ``ssh_extra_args`` for parsing the ``ProxyCommand`` (https://github.com/ansible/ansible/issues/78750)
- paramiko connection was still using outdated playcontext, this should bring it up to date to use the 'correct' data for each task/loop.
- password lookup now correctly reads stored ident fields.
- password_hash - handle errors using unknown passlib hashtypes more gracefully (https://github.com/ansible/ansible/issues/45392).
- plugin loader, fix detection for existing configuration before initializing for a plugin
- role deduplication - Always create new role object, regardless of deduplication. Deduplication will only affect whether a duplicate call to a role will execute, as opposed to re-using the same object. (https://github.com/ansible/ansible/pull/78661)
- roles - Fix templating ``public``, ``allow_duplicates`` and ``rolespec_validate`` (https://github.com/ansible/ansible/issues/80304).
- service_facts - Use python re to parse service output instead of grep (https://github.com/ansible/ansible/issues/78541)
- strategy plugins now correctly identify bad registered variables, even on skip.
- strategy plugins: get the correctly templated and validated run_once value on strategy linear (https://github.com/ansible/ansible/issues/78492)
- systemd - daemon-reload and daemon-reexec ignore errors when running in a chroot (https://github.com/ansible/ansible/pull/79643)
- templates - Fixed ``TypeError`` when a lookup plugin has an option called ``name``.
- unarchive - allow relative path for ``dest`` (https://github.com/ansible/ansible/issues/64612)
- unarchive - log errors from commands to assist in debugging (https://github.com/ansible/ansible/issues/64612)
- updated error messages to include 'acl' and not just mode changes when failing to set required permissions on remote.
- uri - improve JSON content type detection
- user - fix comparing group IDs to existing group names so groups are not always updated (https://github.com/ansible/ansible/issues/79956).
- user module - Removed ``password_expire_max`` from the return docs, as it is not returned.
- user module - Removed ``password_expire_min`` from the return docs, as it is not returned.
- vault - show filename additionally if missing secrets prevents decryption (https://github.com/ansible/ansible/issues/79723)
- winrm - Increase the read timeout to 10 seconds later than the operation timeout reducing the chances of a false read timeout
Known Issues
------------
- ansible-test - Additional configuration may be required for certain container host and container combinations. Further details are available in the testing documentation.
- ansible-test - Custom containers with ``VOLUME`` instructions may be unable to start, when previously the containers started correctly. Remove the ``VOLUME`` instructions to resolve the issue. Containers with this condition will cause ``ansible-test`` to emit a warning.
- ansible-test - Systems with Podman networking issues may be unable to run containers, when previously the issue went unreported. Correct the networking issues to continue using ``ansible-test`` with Podman.
- ansible-test - Unit tests for collections do not support ``pytest`` assertion rewriting on Python 2.7.
- ansible-test - Using Docker on systems with SELinux may require setting SELinux to permissive mode. Podman should work with SELinux in enforcing mode.
- dnf5 - The DNF5 package manager currently does not provide all functionality to ensure feature parity between the existing ``dnf`` and the new ``dnf5`` module. As a result the following ``dnf5`` options are effectively a no-op: ``cacheonly``, ``enable_plugin``, ``disable_plugin`` and ``lock_timeout``.
New Plugins
-----------
Filter
~~~~~~
- commonpath - gets the common path
- normpath - Normalize a pathname
New Modules
-----------
Lib
~~~
ansible.modules
^^^^^^^^^^^^^^^
- deb822_repository - Add and remove deb822 formatted repositories
- dnf5 - Manages packages with the I(dnf5) package manager

View File

@ -1,2 +1,755 @@
ancestor: 2.14.0
releases: {}
releases:
2.15.0b1:
changes:
breaking_changes:
- ansible-doc - no longer treat plugins in collections whose name starts with
``_`` as deprecated (https://github.com/ansible/ansible/pull/79217).
- ansible-test - Integration tests which depend on specific file permissions
when running in an ansible-test managed host environment may require changes.
Tests that require permissions other than ``755`` or ``644`` may need to be
updated to set the necessary permissions as part of the test run.
- ansible-test - The ``vcenter`` test plugin now defaults to using a user-provided
static configuration instead of the ``govcsim`` simulator for collections.
Set the ``ANSIBLE_VCSIM_CONTAINER`` environment variable to ``govcsim`` to
use the simulator. Keep in mind that the simulator is deprecated and will
be removed in a future release.
- ansible-test sanity - previously plugins and modules in collections whose
name started with ``_`` were treated as deprecated, even when they were not
marked as deprecated in ``meta/runtime.yml``. This is no longer the case (https://github.com/ansible/ansible/pull/79362).
- ansible-test validate-modules - Removed the ``missing-python-doc`` error code
in validate modules, ``missing-documentation`` is used instead for missing
PowerShell module documentation.
bugfixes:
- Ansible.Basic.cs - Ignore compiler warning (reported as an error) when running
under PowerShell 7.3.x.
- BSD network facts - Do not assume column indexes, look for ``netmask`` and
``broadcast`` for determining the correct columns when parsing ``inet`` line
(https://github.com/ansible/ansible/issues/79117)
- Correctly count rescued tasks in play recap (https://github.com/ansible/ansible/issues/79711)
- Do not crash when templating an expression with a test or filter that is not
a valid Ansible filter name (https://github.com/ansible/ansible/issues/78912,
https://github.com/ansible/ansible/pull/78913).
- Fix ``MANIFEST.in`` to exclude unwanted files in the ``packaging/`` directory.
- Fix ``MANIFEST.in`` to include ``*.md`` files in the ``test/support/`` directory.
- Fix a traceback occuring when a task is named ``meta`` (https://github.com/ansible/ansible/issues/79459)
- Fix an issue where the value of ``become`` was ignored when used on a role
used as a dependency in ``main/meta.yml`` (https://github.com/ansible/ansible/issues/79777)
- Fix bug in `vars` applied to roles, they were being incorrectly exported among
others while only vars/main.yml was meant to be. Also adjusted the precedence
to act the same as inline params.
- Fix conditionally notifying ``include_tasks` handlers when ``force_handlers``
is used (https://github.com/ansible/ansible/issues/79776)
- Fix reusing a connection in a task loop that uses a redirected or aliased
name - https://github.com/ansible/ansible/issues/78425
- Fix setting become activation in a task loop - https://github.com/ansible/ansible/issues/78425
- Fix traceback when using the ``template`` module and running with ``ANSIBLE_DEBUG=1``
(https://github.com/ansible/ansible/issues/79763)
- Fix using ``GALAXY_IGNORE_CERTS`` in conjunction with collections in requirements
files which specify a specific ``source`` that isn't in the configured servers.
- Fix using ``GALAXY_IGNORE_CERTS`` when downloading tarballs from Galaxy servers
(https://github.com/ansible/ansible/issues/79557).
- Fixes leftover _valid_attrs usage.
- Fixes the password lookup to not rewrite files if they are not changed when
using the "encrypt" parameter (#79430).
- Module and role argument validation - include the valid suboption choices
in the error when an invalid suboption is provided.
- Perform type check on data passed to Display.display to enforce the requirement
of being given a python3 unicode string
- TaskExecutor - don't ignore templated _raw_params that k=v parser failed to
parse (https://github.com/ansible/ansible/issues/79862)
- Windows - Display a warning if the module failed to cleanup any temporary
files rather than failing the task. The warning contains a brief description
of what failed to be deleted.
- Windows - Ensure the module temp directory contains more unique values to
avoid conflicts with concurrent runs - https://github.com/ansible/ansible/issues/80294
- Windows - Improve temporary file cleanup used by modules. Will use a more
reliable delete operation on Windows Server 2016 and newer to delete files
that might still be open by other software like Anti Virus scanners. There
are still scenarios where a file or directory cannot be deleted but the new
method should work in more scenarios.
- '``ansible-galaxy search rolename`` - give a warning instead of non-zero return
code when search results are empty. This is similar to the behavior when listing
roles, which gives a warning if a role cannot be found and exits with a return
code of ``0``.'
- '``ansible_eval_concat`` - avoid redundant unsafe wrapping of templated strings
converted to Python types'
- ansible-config limit shorthand format to assigned values
- ansible-doc - stop generating wrong module URLs for module see-alsos. The
URLs for modules in ansible.builtin do now work, and URLs for modules outside
ansible.builtin are no longer added (https://github.com/ansible/ansible/pull/80280).
- ansible-doc now will correctly display short descriptions on listing filters/tests
no matter the directory sorting.
- ansible-galaxy - Improve retries for collection installs, to properly retry,
and extend retry logic to common URL related connection errors (https://github.com/ansible/ansible/issues/80170
https://github.com/ansible/ansible/issues/80174)
- ansible-galaxy - fix installing collections in git repositories/directories
which contain a MANIFEST.json file (https://github.com/ansible/ansible/issues/79796).
- ansible-galaxy - make initial call to Galaxy server on-demand only when installing,
getting info about, and listing roles.
- ansible-galaxy collection install - respect symlinks when installing from
source or local repository (https://github.com/ansible/ansible/issues/78442)
- ansible-galaxy collection/role init - preserve symlinks (https://github.com/ansible/ansible/issues/39334).
- ansible-galaxy role info - fix unhandled AttributeError by catching the correct
exception.
- ansible-inventory will no longer duplicate host entries if they were part
of a group's childrens tree.
- ansible-inventory will not explicitly sort groups/hosts anymore, giving a
chance (depending on output format) to match the order in the input sources.
- ansible-playbook -K breaks when passwords have quotes (https://github.com/ansible/ansible/issues/79836).
- ansible-test - Add ``wheel < 0.38.0`` constraint for Python 3.6 and earlier.
- ansible-test - Add support for ``pytest`` assertion rewriting when running
unit tests on Python 3.5 and later. Resolves issue https://github.com/ansible/ansible/issues/68032
- ansible-test - Added a work-around for a traceback under Python 3.11 when
completing certain command line options.
- ansible-test - Allow disabled, unsupported, unstable and destructive integration
test targets to be selected using their respective prefixes.
- ansible-test - Allow unstable tests to run when targeted changes are made
and the ``--allow-unstable-changed`` option is specified (resolves https://github.com/ansible/ansible/issues/74213).
- ansible-test - Always indicate the Python version being used before installing
requirements. Resolves issue https://github.com/ansible/ansible/issues/72855
- ansible-test - Avoid using ``exec`` after container startup when possible.
This improves container startup performance and avoids intermittent startup
issues with some old containers.
- ansible-test - Connection attempts to managed remote instances no longer abort
on ``Permission denied`` errors.
- ansible-test - Detection for running in a Podman or Docker container has been
fixed to detect more scenarios. The new detection relies on ``/proc/self/mountinfo``
instead of ``/proc/self/cpuset``. Detection now works with custom cgroups
and private cgroup namespaces.
- ansible-test - Exclude ansible-core vendored Python packages from ansible-test
payloads.
- ansible-test - Fix broken documentation link for ``aws`` test plugin error
messages.
- ansible-test - Fix validate-modules error when retrieving PowerShell argspec
when retrieved inside a Cmdlet
- ansible-test - Handle server errors when executing the ``docker info`` command.
- ansible-test - Integration test target prefixes defined in a ``tests/integration/target-prefixes.{group}``
file can now contain an underscore (``_``) character. Resolves issue https://github.com/ansible/ansible/issues/79225
- ansible-test - Multiple containers now work under Podman without specifying
the ``--docker-network`` option.
- ansible-test - Pass the ``XDG_RUNTIME_DIR`` environment variable through to
container commands.
- ansible-test - Perform PyPI proxy configuration after instances are ready
and bootstrapping has been completed. Only target instances are affected,
as controller instances were already handled this way. This avoids proxy configuration
errors when target instances are not yet ready for use.
- ansible-test - Prevent concurrent / repeat inspections of the same container
image.
- ansible-test - Prevent concurrent / repeat pulls of the same container image.
- ansible-test - Prevent concurrent execution of cached methods.
- ansible-test - Removed pointless comparison in diff evaluation logic.
- ansible-test - Set ``PYLINTHOME`` for the ``pylint`` sanity test to prevent
failures due to ``pylint`` checking for the existence of an obsolete home
directory.
- ansible-test - Show the exception type when reporting errors during instance
provisioning.
- ansible-test - Support Podman 4.4.0+ by adding the ``SYS_CHROOT`` capability
when running containers.
- ansible-test - Support loading of vendored Python packages from ansible-core.
- ansible-test - The ``validate-modules`` sanity test now properly enforces
documentation before imports for plugins. Previously this was only enforced
for modules due to a coding error.
- ansible-test - Update the ``pylint`` sanity test requirements to resolve crashes
on Python 3.11. (https://github.com/ansible/ansible/issues/78882)
- ansible-test - Update the ``pylint`` sanity test to use version 2.15.4.
- ansible-test - Update the ``pylint`` sanity test to use version 2.15.5.
- ansible-test - Use consistent file permissions when delegating tests to a
container or remote host. Files with any execute bit set will use permissions
``755``. All other files will use permissions ``644``. (Resolves issue https://github.com/ansible/ansible/issues/75079)
- ansible-test - fix warning message about failing to run an image to include
the image name
- ansible-test runtime-metadata sanity test - do not crash on YAML parsing errors
without a context mark (https://github.com/ansible/ansible/pull/78802).
- ansible-test sanity - correctly report invalid YAML in validate-modules (https://github.com/ansible/ansible/issues/75837).
- ansible-vault encrypt_string - started appending a line feed at the end of
the encrypted string output. Missing newline character caused problems identifying
where the string ends in some shells (like bash) or accidentally copying an
extra trailing terminator symbol (e.g., zsh prints out a ``%`` sign to signal
where the original output stops) (https://github.com/ansible/ansible/issues/78932).
- ansible_facts.hardware - Define all processor facts on s390x (https://github.com/ansible/ansible/issues/19755)
- apt - set locale to fix updating the cache (https://github.com/ansible/ansible/issues/79523).
- apt module should not traceback on invalid type given as package. issue 78663.
- apt_repository will no longer fail to detect key when unrelated errors/warnings
are issued by apt-key.
- argument spec validation - again report deprecated parameters for Python-based
modules. This was accidentally removed in ansible-core 2.11 when argument
spec validation was refactored (https://github.com/ansible/ansible/issues/79680,
https://github.com/ansible/ansible/pull/79681).
- argument spec validation - ensure that deprecated aliases in suboptions are
also reported (https://github.com/ansible/ansible/pull/79740).
- argument spec validation - fix warning message when two aliases of the same
option are used for suboptions to also mention the option's name they are
in (https://github.com/ansible/ansible/pull/79740).
- basic.py module_utils - Perform Python version check much earlier to ensure
it runs before other errors occur.
- connection local now avoids traceback on invalid user being used to execuet
ansible (valid in host, but not in container).
- copy - fix creating the dest directory in check mode with remote_src=True
(https://github.com/ansible/ansible/issues/78611).
- copy - fix reporting changes to file attributes in check mode with remote_src=True
(https://github.com/ansible/ansible/issues/77957).
- copy module will no longer move 'non files' set as src when remote_src=true.
- copy remote_src=true - fix copying subdirs recursively when the dest exists
and the src and dest have multiple common subdirectories in a common directory
(https://github.com/ansible/ansible/issues/74536).
- copy remote_src=true - fix reporting changed for copying empty directories.
- display - reduce risk of post-fork output deadlocks (https://github.com/ansible/ansible/pull/79522)
- file - touch action in check mode was always returning ok. Fix now evaluates
the different conditions and returns the appropriate changed status. (https://github.com/ansible/ansible/issues/79360)
- file lookup now handles missing files more gracefully.
- file lookup now plays nice with generic lookup ``errors`` option.
- get_url - Ensure we are passing ciphers to all url_get calls (https://github.com/ansible/ansible/issues/79717)
- get_url module - Added a documentation reference to ``hashlib`` regarding
algorithms, as well as a note about ``md5`` support on systems running in
FIPS compliant mode.
- get_url module - Removed out-of-date documentation stating that ``hashlib``
is a third-party library.
- 'handlers - fix an issue where the ``flush_handlers`` meta task could not
be used with FQCN: ``ansible.builtin.meta`` (https://github.com/ansible/ansible/issues/79023)'
- include_role - Inherit from role parents beyond a depth of 3 (https://github.com/ansible/ansible/issues/47023).
- jinja2_native - fix intermittent 'could not find job' failures when a value
of ``ansible_job_id`` from a result of an async task was inadvertently changed
during execution; to prevent this a format of ``ansible_job_id`` was changed.
- 'jinja2_native: preserve quotes in strings (https://github.com/ansible/ansible/issues/79083)'
- keyword inheritance - Ensure that we do not squash keywords in validate (https://github.com/ansible/ansible/issues/79021)
- known_hosts - do not return changed status when a non-existing key is removed
(https://github.com/ansible/ansible/issues/78598)
- list-tags now shows the 'never' tag, which was being excluded by default.
To list all tasks you still need to add `--list-tasks --tags never,all`.
- loops/delegate_to - Do not double calculate the values of loops and ``delegate_to``
(https://github.com/ansible/ansible/issues/80038)
- module_utils/basic.py - Fix detection of available hashing algorithms on Python
3.x. All supported algorithms are now available instead of being limited to
a hard-coded list. This affects modules such as ``get_url`` which accept an
arbitrary checksum algorithm.
- normal action plugin - remove obsolete ``if`` (https://github.com/ansible/ansible/pull/79690).
- omit on keywords was resetting to default value, ignoring inheritance.
- paramiko - Add a new option to allow paramiko >= 2.9 to easily work with all
devices now that rsa-sha2 support was added to paramiko, which prevented communication
with numerous platforms. (https://github.com/ansible/ansible/issues/76737)
- paramiko - Add back support for ``ssh_args``, ``ssh_common_args``, and ``ssh_extra_args``
for parsing the ``ProxyCommand`` (https://github.com/ansible/ansible/issues/78750)
- paramiko connection was still using outdated playcontext, this should bring
it up to date to use the 'correct' data for each task/loop.
- password lookup now correctly reads stored ident fields.
- password_hash - handle errors using unknown passlib hashtypes more gracefully
(https://github.com/ansible/ansible/issues/45392).
- plugin loader, fix detection for existing configuration before initializing
for a plugin
- role deduplication - Always create new role object, regardless of deduplication.
Deduplication will only affect whether a duplicate call to a role will execute,
as opposed to re-using the same object. (https://github.com/ansible/ansible/pull/78661)
- roles - Fix templating ``public``, ``allow_duplicates`` and ``rolespec_validate``
(https://github.com/ansible/ansible/issues/80304).
- service_facts - Use python re to parse service output instead of grep (https://github.com/ansible/ansible/issues/78541)
- strategy plugins now correctly identify bad registered variables, even on
skip.
- 'strategy plugins: get the correctly templated and validated run_once value
on strategy linear (https://github.com/ansible/ansible/issues/78492)'
- systemd - daemon-reload and daemon-reexec ignore errors when running in a
chroot (https://github.com/ansible/ansible/pull/79643)
- templates - Fixed ``TypeError`` when a lookup plugin has an option called
``name``.
- unarchive - allow relative path for ``dest`` (https://github.com/ansible/ansible/issues/64612)
- unarchive - log errors from commands to assist in debugging (https://github.com/ansible/ansible/issues/64612)
- updated error messages to include 'acl' and not just mode changes when failing
to set required permissions on remote.
- uri - improve JSON content type detection
- user - fix comparing group IDs to existing group names so groups are not always
updated (https://github.com/ansible/ansible/issues/79956).
- user module - Removed ``password_expire_max`` from the return docs, as it
is not returned.
- user module - Removed ``password_expire_min`` from the return docs, as it
is not returned.
- vault - show filename additionally if missing secrets prevents decryption
(https://github.com/ansible/ansible/issues/79723)
- winrm - Increase the read timeout to 10 seconds later than the operation timeout
reducing the chances of a false read timeout
deprecated_features:
- The ``ConnectionBase()._new_stdin`` attribute is deprecated, use ``display.prompt_until(msg)``
instead.
- ansible-test - The ``foreman`` test plugin is now deprecated. It will be removed
in a future release.
- ansible-test - The ``govcsim`` simulator in the ``vcenter`` test plugin is
now deprecated. It will be removed in a future release. Users should switch
to providing their own test environment through a static configuration file.
- password_hash - deprecate using passlib.hash.hashtype if hashtype isn't in
the list of documented choices.
- vars - Specifying a list of dictionaries for ``vars:`` is deprecated in favor
of specifying a dictionary.
known_issues:
- ansible-test - Additional configuration may be required for certain container
host and container combinations. Further details are available in the testing
documentation.
- ansible-test - Custom containers with ``VOLUME`` instructions may be unable
to start, when previously the containers started correctly. Remove the ``VOLUME``
instructions to resolve the issue. Containers with this condition will cause
``ansible-test`` to emit a warning.
- ansible-test - Systems with Podman networking issues may be unable to run
containers, when previously the issue went unreported. Correct the networking
issues to continue using ``ansible-test`` with Podman.
- ansible-test - Unit tests for collections do not support ``pytest`` assertion
rewriting on Python 2.7.
- ansible-test - Using Docker on systems with SELinux may require setting SELinux
to permissive mode. Podman should work with SELinux in enforcing mode.
- 'dnf5 - The DNF5 package manager currently does not provide all functionality
to ensure feature parity between the existing ``dnf`` and the new ``dnf5``
module. As a result the following ``dnf5`` options are effectively a no-op:
``cacheonly``, ``enable_plugin``, ``disable_plugin`` and ``lock_timeout``.'
major_changes:
- ansible-test - Docker Desktop on WSL2 is now supported (additional configuration
required).
- ansible-test - Docker and Podman are now supported on hosts with cgroup v2
unified. Previously only cgroup v1 and cgroup v2 hybrid were supported.
- ansible-test - Podman now works on container hosts without systemd. Previously
only some containers worked, while others required rootfull or rootless Podman,
but would not work with both. Some containers did not work at all.
- ansible-test - Podman on WSL2 is now supported.
- ansible-test - When additional cgroup setup is required on the container host,
this will be automatically detected. Instructions on how to configure the
host will be provided in the error message shown.
minor_changes:
- Add support for custom salt for vault encoding to make it deterministic (https://github.com/ansible/ansible/issues/35480).
- Added the conditional that was False if ``when`` caused a task to skip under
``false_condition``.
- Allow force deletion of a group even when it is the primary group of a user.
(https://github.com/ansible/ansible/issues/77849)
- Ansible.ModuleUtils.AddType - Add support for compiling ``unsafe`` code with
the ``//AllowUnsafe`` directive
- Cache field attributes list on the playbook classes
- Cleaned up unused imports in core.
- Get user input for ``pause`` and ``paramiko_ssh`` from the strategy rather
than access ``sys.stdin`` in the WorkerProcess.
- Introduce ``Delegatable`` and ``Notifiable`` mixin classes for playbook objects
- Make using blocks as handlers a parser error (https://github.com/ansible/ansible/issues/79968)
- Playbook objects - Replace deprecated stacked ``@classmethod`` and ``@property``
- Raise an error when an incorrect ``isa`` type is passed to ``FieldAttribute``.
- Remove fallback code for when ``defined``/``undefined`` tests were used on
objects containing nested undefined variables; due to changes in lazy evalution
of Jinja2 expressions it is no longer needed.
- 'Remove unused Python stdlib imports from module_utils which were not present
for backwards compatibility in: common.file, compat.selectors, facts.network.iscsi,
facts.network.nvme, yumdnf
'
- 'Remove unused internal imports from module_utils which were not present for
backwards compatibility in: common.file, common.parameters, facts.system.caps,
yumdnf
'
- Removed ``straight.plugin`` from the build and packaging requirements.
- 'Removed unused imports from the following action plugins: async_status, command,
pause, set_stats, uri, validate_argument_spec'
- 'Removed unused imports from the following lookup plugins: fileglob, template'
- 'Removed unused imports from the following modules: apt, dnf, expect, pip,
slurp, user, yum'
- 'Removed unused imports from the following set of test plugins: files'
- 'Removed unused imports from the following strategy plugins: debug'
- 'Removed unused imports from the following vars plugins: host_group_vars'
- Use ``ansible.module_utils.six.moves.collections_abc`` instead of ``ansible.module_utils.common._collections_compat``
in modules and module_utils.
- Use ``collections.abc`` instead of ``ansible.module_utils.common._collections_compat``
in controller code.
- '``AnsibleJ2Vars`` class that acts as a storage for all variables for templating
purposes now uses ``collections.ChainMap`` internally.'
- add parameter ``numeric`` to the iptables module to disable dns lookups when
running list -action internally (https://github.com/ansible/ansible/issues/78793).
- allow user to set ansible specific env vars for selecting pager and editor,
but still fall back to commonly used defaults.
- ansible-doc - support role extension for semantic markup spec so that ``O()``
and ``RV()`` referring to role entrypoints are rendered more readable (https://github.com/ansible/ansible/pull/80305).
- ansible-doc - support semantic markup in text output (https://github.com/ansible/ansible/pull/80242).
- ansible-doc text output - support ``seealso`` plugin record that was added
for filter and test plugin documentation (https://github.com/ansible/ansible/pull/80212).
- ansible-galaxy - Add ability to specify collection versions on the CLI without
the need for a colon. Such as ``namespace.name==1.2.3`` vs ``namespace.name:1.2.3``.
- ansible-galaxy - Use Python's native ``raise ... from`` instead of ``six.raise_from``.
- ansible-galaxy - support ``resolvelib >= 0.5.3, < 0.10.0``.
- ansible-galaxy - support ``resolvelib >= 0.5.3, < 1.1.0``.
- ansible-inventory now supports the limit command line options.
- ansible-test - A new ``audit`` option is available when running custom containers.
This option can be used to indicate whether a container requires the AUDIT_WRITE
capability. The default is ``required``, which most containers will need when
using Podman. If necessary, the ``none`` option can be used to opt-out of
the capability. This has no effect on Docker, which always provides the capability.
- ansible-test - A new ``cgroup`` option is available when running custom containers.
This option can be used to indicate a container requires cgroup v1 or that
it does not use cgroup. The default behavior assumes the container works with
cgroup v2 (as well as v1).
- ansible-test - Add Alpine 3.17 remote.
- ansible-test - Add Fedora 37 container.
- ansible-test - Add Fedora 37 remote.
- ansible-test - Add FreeBSD 12.4 remote.
- ansible-test - Add RHEL 8.7 remote.
- ansible-test - Add RHEL 9.1 remote.
- ansible-test - Add macOS 13.2 remote.
- ansible-test - Additional log details are shown when containers fail to start
or SSH connections to containers fail.
- ansible-test - Connection failures to remote provisioned hosts now show failure
details as a warning.
- ansible-test - Containers included with ansible-test no longer disable seccomp
by default.
- ansible-test - Disabled the ``ansible-format-automatic-specification`` rule
from the ``pylint`` sanity test, now that Python 2.6 is no longer supported.
- ansible-test - Enable the ``trailing-comma-tuple`` rule in the ``pylint``
sanity test.
- ansible-test - Enable the ``unused-import`` rule for the ``pylint`` sanity
test for collections.
- ansible-test - Failure to connect to a container over SSH now results in a
clear error. Previously tests would be attempted even after initial connection
attempts failed.
- ansible-test - Improve consistency of executed ``pylint`` commands by making
the plugins ordered.
- ansible-test - Improve consistency of version specific documentation links.
- ansible-test - Integration tests can be excluded from retries triggered by
the ``--retry-on-error`` option by adding the ``retry/never`` alias. This
is useful for tests that cannot pass on a retry or are too slow to make retries
useful.
- ansible-test - Minor cleanup and package updates in distro containers.
- ansible-test - More details are provided about an instance when provisioning
fails.
- ansible-test - Moved git handling out of the validate-modules sanity test
and into ansible-test.
- ansible-test - Reduce the polling limit for SSHD startup in containers from
60 retries to 10. The one second delay between retries remains in place.
- 'ansible-test - Removed test containers: fedora36'
- 'ansible-test - Removed test remotes: alpine/3.16, fedora/36, freebsd/12.3,
rhel/8.6, rhel/9.0, macos/12.0'
- ansible-test - Removed the ``--keep-git`` sanity test option, which was limited
to testing ansible-core itself.
- ansible-test - SSH connections from OpenSSH 8.8+ to CentOS 6 containers now
work without additional configuration. However, clients older than OpenSSH
7.0 can no longer connect to CentOS 6 containers as a result. The container
must have ``centos6`` in the image name for this work-around to be applied.
- ansible-test - SSH shell connections from OpenSSH 8.8+ to ansible-test provisioned
network instances now work without additional configuration. However, clients
older than OpenSSH 7.0 can no longer open shell sessions for ansible-test
provisioned network instances as a result.
- 'ansible-test - Specify the configuration file location required by test plugins
when the config file is not found. This resolves issue: https://github.com/ansible/ansible/issues/79411'
- ansible-test - The ``ansible-test env`` command now detects and reports the
container ID if running in a container.
- ansible-test - The ``pep8`` sanity test rule ``E203`` is now disabled since
it is not PEP 8 compliant. This provides compatibility with output generated
by the ``black`` code formatter.
- ansible-test - The ``validate-modules`` sanity test no longer limits the ``__future__``
imports that can be used. Other sanity tests that check ``__future__`` imports
remain unchanged. As a result, the error code ``illegal-future-imports`` is
no longer used.
- ansible-test - Unit tests now support network disconnect by default when running
under Podman. Previously this feature only worked by default under Docker.
- ansible-test - Update Alpine 3 container to 3.17.
- ansible-test - Update Python requirements used for sanity tests.
- ansible-test - Update ``base`` and ``default`` containers to include Python
3.11.0.
- ansible-test - Update ``default`` containers to include new ``docs-build``
sanity test requirements.
- ansible-test - Update error handling code to use Python 3.x constructs, avoiding
direct use of ``errno``.
- ansible-test - Update test container to ``7.4.0`` which includes the new PSScriptAnalyzer
versions
- ansible-test - Update the CloudStack test plugin to use a newer test container
with CloudStack 4.18.0.
- ansible-test - Update the NIOS test plugin to use a newer multi-arch test
container.
- ansible-test - Update the ``ansible-bad-import-from`` rule in the ``pylint``
sanity test to recommend ``ansible.module_utils.six.moves.collections_abc``
instead of ``ansible.module_utils.common._collections_compat``.
- ansible-test - Update the ``base`` and ``default`` test containers with the
latest requirements.
- ansible-test - Updated the Azure Pipelines CI plugin to work with newer versions
of git.
- ansible-test - Use ``stop --time 0`` followed by ``rm`` to remove ephemeral
containers instead of ``rm -f``. This speeds up teardown of ephemeral containers.
- ansible-test - Warnings are now shown when using containers that were built
with VOLUME instructions.
- ansible-test - When setting the max open files for containers, the container
host's limit will be checked. If the host limit is lower than the preferred
value, it will be used and a warning will be shown.
- ansible-test - When using Podman, ansible-test will detect if the loginuid
used in containers is incorrect. When this occurs a warning is displayed and
the container is run with the AUDIT_CONTROL capability. Previously containers
would fail under this situation, with no useful warnings or errors given.
- ansible-test acme test container - update version to update used Pebble version,
underlying Python and Go base containers, and Python requirements (https://github.com/ansible/ansible/pull/79783).
- ansible-test pslint - Upgrade PSScriptAnalyzer to ``1.21.0`` which enables
the ``AvoidMultipleTypeAttributes``, ``AvoidSemicolonsAsLineTerminators``,
and ``AvoidUsingBrokenHashAlgorithms`` rules
- ansible-test runtime-metadata sanity test - ensure that ``redirect`` entries
in ``meta/runtime.yml`` contain collection names, except for ``module_utils``
plugin redirects and ``import_redirect`` redirects (https://github.com/ansible/ansible/pull/78802).
- ansible-test sanity --test ansible-doc - now also lists documentation for
test and filter plugins that are documented (https://github.com/ansible/ansible/pull/77737).
- ansible-test validate-modules - Added support for validating module documentation
stored in a sidecar file alongside the module (``{module}.yml`` or ``{module}.yaml``).
Previously these files were ignored and documentation had to be placed in
``{module}.py``.
- ansible-test validate-modules - no longer treat falsy non-``False`` values
for defaults as ``None`` (https://github.com/ansible/ansible/pull/79267).
- apt - add allow-change-held-packages option to apt remove (https://github.com/ansible/ansible/issues/78131)
- apt_repository - adds ``sources_added`` and ``sources_removed`` to the return
of the module (https://github.com/ansible/ansible/issues/79306).
- apt_repository will use the trust repo directories in order of preference
(more appropriate to less) as they exist on the target.
- collections - Add additional ignores for commonly rejected file extensions
- collections - Add additional includes for REUSE license files (https://github.com/ansible/ansible/issues/79368)
- deb822_repository - Add new module for managing DEB822 formatted apt repositories
- debug - Perform argspec valdiation in debug action plugin (https://github.com/ansible/ansible/issues/79862)
- dnf5 - Add new module for managing packages and other artifacts via the next
version of DNF (https://github.com/ansible/ansible/issues/78898)
- galaxy - include ``license_file`` in the default manifest directives (https://github.com/ansible/ansible/pull-request/79420)
- optimized var loading by caching results as there is no variance in input
during run.
- pycompat24 module_utils - Remove support for Python 2.5 and earlier.
- sanity tests - updates the collection-deprecated-version tests to ignore the
``prerelease`` component of the collection version ().
- strftime filter, additional docs and links to source of truth.
- updated the vendored distro library to upstream version (https://github.com/ansible/ansible/pull/79227)
- validate-modules sanity test - add support for semantic markup (https://github.com/ansible/ansible/pull/80243).
- validate-modules sanity test - if the ``check_mode`` attribute is present,
check that it coincides with the ``support_check_mode`` parameter of ``AnsibleModule``
(https://github.com/ansible/ansible/pull/80090).
- validate-modules sanity test - remove support for the never implemented ``forced_action_plugin``
attribute (https://github.com/ansible/ansible/pull/79317).
- validate-modules sanity test - support the ``plugin`` see-also part of the
semantic markup specification (https://github.com/ansible/ansible/pull/80244).
release_summary: '| Release Date: 2023-04-04
| `Porting Guide <https://docs.ansible.com/ansible-core/2.15/porting_guides/porting_guide_core_2.15.html>`__
'
removed_features:
- Remove deprecated ``ANSIBLE_CALLBACK_WHITELIST`` configuration environment
variable, use ``ANSIBLE_CALLBACKS_ENABLED`` instead. (https://github.com/ansible/ansible/issues/78821)
- Remove deprecated ``ANSIBLE_COW_WHITELIST`` configuration environment variable,
use ``ANSIBLE_COW_ACCEPTLIST`` instead. (https://github.com/ansible/ansible/issues/78819)
- Remove deprecated ``callback_whitelist`` configuration option, use ``callbacks_enabled``
instead. (https://github.com/ansible/ansible/issues/78822)
- Remove deprecated ``cow_whitelist`` configuration option, use ``cowsay_enabled_stencils``
instead. (https://github.com/ansible/ansible/issues/78820)
codename: Ten Years Gone
fragments:
- 19755-ansible_processor-s390x.yml
- 2.15.0b1_summary.yaml
- 20221021-deprecated-sanity.yml
- 64612-unarchive-log-command-output.yml
- 64612-unarchive-relative-path-dest.yml
- 71424-deterministic-vault-encode.yml
- 75837-validate-modules-invalid-yaml.yml
- 76578-fix-role-argspec-suboptions-error.yml
- 76737-paramiko-rsa-sha2.yml
- 76997-fix-copy-subdirs-with-remote-src.yml
- 77737-ansible-doc-test-filters-tests.yml
- 78172-allow-force-deletion-of-group.yaml
- 78492-fix-invalid-run_once-value.yml
- 78541-service-facts-re.yml
- 78624-copy-remote-src-check-mode.yml
- 78748-fix-known-hosts-wrong-changed-status.yaml
- 78750-paramiko-ssh-args-compat.yml
- 78802-sanity-meta-runtime.yml
- 78819-78820-remove-deprecated-cow-options.yml
- 78821-78822-remove-callback_whitelist.yml
- 78828-iptables-option-to-disable-dns-lookups.yml
- 78913-template-missing-filter-test.yml
- 78983-fix-collection-install-from-source-respects-dir-symlinks.yaml
- 79017-ansible-vault-string-encryption-ending-with-newline.yml
- 79021-dont-squash-in-validate.yml
- 79023-fix-flush_handlers-fqcn.yml
- 79079-fix-role-dep-chain.yaml
- 79083-jinja2_native-preserve-quotes-in-strings.yml
- 79117-bsd-ifconfig-inet-fix.yml
- 79134-ansible-galaxy-init-symlinks.yml
- 79187--wheel-0.38.0.yml
- 79227-update-vendored-distro.yaml
- 79267-validate-modules-defaults.yml
- 79362-validate-modules-underscore.yml
- 79368-galaxy-manifest-reuse-licenses.yml
- 79376-replace-valid-attrs-with-fattributes.yaml
- 79399-resolvelib_lt_0_10_0.yml
- 79420-galaxy-manifest-license.yaml
- 79422-fix-file-touch-check-mode-status.yaml
- 79431-fix-password-lookup-rewrites.yml
- 79459-fix-meta-task-check.yml
- 79546-apt-fix-setting-locale.yml
- 79561-fix-a-g-global-ignore-certs-cfg.yml
- 79643-fix-systemd-daemon-reload-in-chroot.yml
- 79658-improving-return-and-docs.yaml
- 79681-argspec-param-deprecation.yml
- 79690-normal-action-undefined.yml
- 79711-fix-play-stats-rescued.yml
- 79717-get-url-ciphers.yml
- 79732-filename_in_decrypt_error.yml
- 79740-aliases-warnings-deprecations-in-suboptions.yml
- 79763-ansible_debug_template_tb_fix.yml
- 79776-fix-force_handlers-cond-include.yml
- 79777-fix-inheritance-roles-meta.yml
- 79783-acme-test-container.yml
- 79837-unquoting-only-when-origin-is-ini.yml
- 79839-lookup-option-name.yml
- 79862-debug-action-args.yml
- 79862-fix-varargs.yml
- 79968-blocks-handlers-error.yml
- 79981-user-fix-groups-comparison.yml
- 80090-validate-modules-check_mode-attribute.yml
- 80196-resolvelib_lt_1_1_0.yml
- 80212-ansible-doc-seealso.yml
- 80242-ansible-doc-semantic-markup.yml
- 80243-validate-modules.yml
- 80244-validate-modules-seealso.yml
- 80280-ansible-doc-seealso-urls.yml
- 80305-ansible-doc-role-semantic-markup.yml
- AddType-unsafe.yml
- a-g-role-fix-catching-exception.yml
- adjust_config_list.yml
- adoc_fix_list.yml
- ainv_limit.yml
- ainv_limit_fix.yml
- always-create-new-role.yml
- ansible-basic-tmpdir-uniqueness.yml
- ansible-galaxy-install-delay-initial-api-call.yml
- ansible-galaxy-install-git-src-manifest.yml
- ansible-galaxy-role-search-rc.yml
- ansible-test-cloudstack-plugin.yml
- ansible-test-container-management.yml
- ansible-test-containers-docs-build.yml
- ansible-test-containers-python-3.11.0.yml
- ansible-test-default-container-update.yml
- ansible-test-docs-links.yml
- ansible-test-errno.yml
- ansible-test-fix-pointless-comparison.yml
- ansible-test-fix-python-3.11-traceback.yml
- ansible-test-fix-warning-msg.yml
- ansible-test-foreman.yml
- ansible-test-git-handling.yml
- ansible-test-govcsim.yml
- ansible-test-integration-target-prefixes.yml
- ansible-test-integration-targets-filter.yml
- ansible-test-nios-plugin.yml
- ansible-test-payload-file-permissions.yml
- ansible-test-pep8-e203.yml
- ansible-test-podman-chroot.yml
- ansible-test-pylint-2.15.4.yml
- ansible-test-pylint-2.15.5.yml
- ansible-test-pylint-command.yml
- ansible-test-pylint-home.yml
- ansible-test-pylint-string-format.yml
- ansible-test-pylint-trailing-comma-tuple.yml
- ansible-test-pypi-proxy-fix.yml
- ansible-test-pytest-assertion-rewriting.yml
- ansible-test-removed-old-platforms.yml
- ansible-test-requirements-message.yml
- ansible-test-sanity-requirements.yml
- ansible-test-test-plugin-error-message.yml
- ansible-test-unused-import-collections.yml
- ansible-test-updated-platforms.yml
- ansible-test-validate-modules-future-import.yml
- ansible-test-vendoring-support.yml
- ansible_eval_concat-remove-redundant-unsafe-wrap.yml
- ansiblej2vars-chainmap.yml
- apt-remove_allow-change-held-packages.yml
- apt_notb.yml
- apt_repo_fix.yml
- apt_repo_trust_prefs.yml
- basic-version-check.yml
- become-loop-setting.yml
- better-maybe-json-uri.yml
- build-no-straight.yaml
- cache-fa-on-pb-cls.yml
- deb822-repository.yml
- deprecate-non-enforced-password_hash-type-choices.yml
- deprecate-vars-list-of-dicts.yml
- display-display-str-only.yml
- dnf5-module.yml
- dont_move_non_files.yml
- file_lookup_errors.yml
- file_lookup_fix.yml
- fix-manifest.yml
- fix-templating-private-role-FA.yml
- fix_jinja_native_async.yml
- fix_omit_key.yml
- fork_safe_stdio.yml
- galaxy-improve-retries.yml
- galaxy-install-no-colon.yml
- hashlib-algorithms.yml
- isa-value-check.yml
- listalltags.yml
- local_bad_user.yml
- mention_acl.yml
- new-mixins.yml
- new_editor_pager_opts.yml
- no-double-loop-delegate-to-calc.yml
- no-stacked-descriptors.yaml
- optimize_vars_loads.yml
- paramiko_config.yml
- password_lookup_file_fix.yml
- plugin_loader_fix.yml
- powershell-7.3-fix.yml
- prompt-via-worker-queue.yml
- psscriptanalyzer-1.21.0.yml
- pycompat24.yml
- remove-nested-defined-fallback-code.yml
- role_vars_scope_fix.yml
- skip-conditional.yml
- strategy_badid_fix.yml
- strftime_docs.yml
- test-container-update.yml
- unsorted.yml
- unused-imports-core.yml
- unused-imports-module-utils-internal.yml
- unused-imports-module-utils-stdlib.yml
- unused-imports-modules.yml
- unused-imports-plugins.yml
- update-collections-abc-imports.yml
- use-native-raise-from.yml
- user-module-return-docs.yml
- v2.15.0-initial-commit.yaml
- validate-module-ps-cmdlet.yml
- validate-modules-forced_action_plugin.yml
- validate-modules-sidecar.yml
- win-temp-cleanup.yml
- winrm-read-timeout.yml
modules:
- description: Add and remove deb822 formatted repositories
name: deb822_repository
namespace: lib.ansible.modules
- description: Manages packages with the I(dnf5) package manager
name: dnf5
namespace: lib.ansible.modules
plugins:
filter:
- description: gets the common path
name: commonpath
namespace: null
- description: Normalize a pathname
name: normpath
namespace: null
release_date: '2023-04-04'
2.15.0b2:
changes:
bugfixes:
- AnsibleModule.run_command - Only use selectors when needed, and rely on Python
stdlib subprocess for the simple task of collecting stdout/stderr when prompt
matching is not required.
- ansible-galaxy - reduce API calls to servers by fetching signatures only for
final candidates.
- dnf5 - fix module and package names in the message following failed module
respawn attempt
- dnf5 - use the logs API to determine transaction problems
- validate-modules sanity test - replace semantic markup parsing and validating
code with the code from `antsibull-docs-parser 0.2.0 <https://github.com/ansible-community/antsibull-docs-parser/releases/tag/0.2.0>`__
(https://github.com/ansible/ansible/pull/80406).
release_summary: '| Release Date: 2023-04-10
| `Porting Guide <https://docs.ansible.com/ansible-core/2.15/porting_guides/porting_guide_core_2.15.html>`__
'
codename: Ten Years Gone
fragments:
- 2.15.0b2_summary.yaml
- 80334-reduce-ansible-galaxy-api-calls.yml
- 80406-validate-modules-semantic-markup.yml
- dnf5-fix-interpreter-fail-msg.yml
- dnf5-logs-api.yml
- run-command-selectors-prompt-only.yml
release_date: '2023-04-10'

View File

@ -0,0 +1,3 @@
release_summary: |
| Release Date: 2023-04-04
| `Porting Guide <https://docs.ansible.com/ansible-core/2.15/porting_guides/porting_guide_core_2.15.html>`__

View File

@ -0,0 +1,3 @@
release_summary: |
| Release Date: 2023-04-10
| `Porting Guide <https://docs.ansible.com/ansible-core/2.15/porting_guides/porting_guide_core_2.15.html>`__

View File

@ -0,0 +1,2 @@
bugfixes:
- ansible-galaxy - reduce API calls to servers by fetching signatures only for final candidates.

View File

@ -0,0 +1,2 @@
bugfixes:
- "validate-modules sanity test - replace semantic markup parsing and validating code with the code from `antsibull-docs-parser 0.2.0 <https://github.com/ansible-community/antsibull-docs-parser/releases/tag/0.2.0>`__ (https://github.com/ansible/ansible/pull/80406)."

View File

@ -0,0 +1,2 @@
bugfixes:
- dnf5 - fix module and package names in the message following failed module respawn attempt

View File

@ -0,0 +1,2 @@
bugfixes:
- dnf5 - use the logs API to determine transaction problems

View File

@ -0,0 +1,4 @@
bugfixes:
- AnsibleModule.run_command - Only use selectors when needed, and rely on Python
stdlib subprocess for the simple task of collecting stdout/stderr when prompt
matching is not required.

View File

@ -926,8 +926,7 @@ class GalaxyAPI:
try:
signatures = data["signatures"]
except KeyError:
# Noisy since this is used by the dep resolver, so require more verbosity than Galaxy calls
display.vvvvvv(f"Server {self.api_server} has not signed {namespace}.{name}:{version}")
display.vvvv(f"Server {self.api_server} has not signed {namespace}.{name}:{version}")
return []
else:
return [signature_info["signature"] for signature_info in signatures]

View File

@ -769,6 +769,9 @@ def install_collections(
"Skipping signature verification."
)
if concrete_coll_pin.type == 'galaxy':
concrete_coll_pin = concrete_coll_pin.with_signatures_repopulated()
try:
install(concrete_coll_pin, output_path, artifacts_manager)
except AnsibleError as err:

View File

@ -27,7 +27,7 @@ if t.TYPE_CHECKING:
)
from ansible.errors import AnsibleError
from ansible.errors import AnsibleError, AnsibleAssertionError
from ansible.galaxy.api import GalaxyAPI
from ansible.galaxy.collection import HAS_PACKAGING, PkgReq
from ansible.module_utils._text import to_bytes, to_native, to_text
@ -584,3 +584,13 @@ class Candidate(
def __init__(self, *args, **kwargs):
super(Candidate, self).__init__()
def with_signatures_repopulated(self): # type: (Candidate) -> Candidate
"""Populate a new Candidate instance with Galaxy signatures.
:raises AnsibleAssertionError: If the supplied candidate is not sourced from a Galaxy-like index.
"""
if self.type != 'galaxy':
raise AnsibleAssertionError(f"Invalid collection type for {self!r}: unable to get signatures from a galaxy server.")
signatures = self.src.get_collection_signatures(self.namespace, self.name, self.ver)
return self.__class__(self.fqcn, self.ver, self.src, self.type, frozenset([*self.signatures, *signatures]))

View File

@ -392,7 +392,6 @@ class CollectionDependencyProviderBase(AbstractProvider):
if not unsatisfied:
if self._include_signatures:
signatures = src_server.get_collection_signatures(first_req.namespace, first_req.name, version)
for extra_source in extra_signature_sources:
signatures.append(get_signature_from_source(extra_source))
latest_matches.append(

View File

@ -2043,53 +2043,59 @@ class AnsibleModule(object):
# Select PollSelector which is supported by major platforms
selector = selectors.PollSelector()
selector.register(cmd.stdout, selectors.EVENT_READ)
selector.register(cmd.stderr, selectors.EVENT_READ)
if os.name == 'posix':
fcntl.fcntl(cmd.stdout.fileno(), fcntl.F_SETFL, fcntl.fcntl(cmd.stdout.fileno(), fcntl.F_GETFL) | os.O_NONBLOCK)
fcntl.fcntl(cmd.stderr.fileno(), fcntl.F_SETFL, fcntl.fcntl(cmd.stderr.fileno(), fcntl.F_GETFL) | os.O_NONBLOCK)
if data:
if not binary_data:
data += '\n'
if isinstance(data, text_type):
data = to_bytes(data)
cmd.stdin.write(data)
cmd.stdin.close()
while True:
events = selector.select(1)
for key, event in events:
b_chunk = key.fileobj.read()
if b_chunk == b(''):
selector.unregister(key.fileobj)
if key.fileobj == cmd.stdout:
stdout += b_chunk
elif key.fileobj == cmd.stderr:
stderr += b_chunk
# if we're checking for prompts, do it now
if prompt_re:
if prompt_re.search(stdout) and not data:
if encoding:
stdout = to_native(stdout, encoding=encoding, errors=errors)
return (257, stdout, "A prompt was encountered while running a command, but no input data was specified")
# only break out if no pipes are left to read or
# the pipes are completely read and
# the process is terminated
if (not events or not selector.get_map()) and cmd.poll() is not None:
break
# No pipes are left to read but process is not yet terminated
# Only then it is safe to wait for the process to be finished
# NOTE: Actually cmd.poll() is always None here if no selectors are left
elif not selector.get_map() and cmd.poll() is None:
cmd.wait()
# The process is terminated. Since no pipes to read from are
# left, there is no need to call select() again.
break
if not prompt_re:
stdout, stderr = cmd.communicate(input=data)
else:
# We only need this to look for a prompt, to abort instead of hanging
selector.register(cmd.stdout, selectors.EVENT_READ)
selector.register(cmd.stderr, selectors.EVENT_READ)
if os.name == 'posix':
fcntl.fcntl(cmd.stdout.fileno(), fcntl.F_SETFL, fcntl.fcntl(cmd.stdout.fileno(), fcntl.F_GETFL) | os.O_NONBLOCK)
fcntl.fcntl(cmd.stderr.fileno(), fcntl.F_SETFL, fcntl.fcntl(cmd.stderr.fileno(), fcntl.F_GETFL) | os.O_NONBLOCK)
cmd.stdout.close()
cmd.stderr.close()
selector.close()
if data:
cmd.stdin.write(data)
cmd.stdin.close()
while True:
events = selector.select(1)
for key, event in events:
b_chunk = key.fileobj.read()
if b_chunk == b(''):
selector.unregister(key.fileobj)
if key.fileobj == cmd.stdout:
stdout += b_chunk
elif key.fileobj == cmd.stderr:
stderr += b_chunk
# if we're checking for prompts, do it now
if prompt_re:
if prompt_re.search(stdout) and not data:
if encoding:
stdout = to_native(stdout, encoding=encoding, errors=errors)
return (257, stdout, "A prompt was encountered while running a command, but no input data was specified")
# only break out if no pipes are left to read or
# the pipes are completely read and
# the process is terminated
if (not events or not selector.get_map()) and cmd.poll() is not None:
break
# No pipes are left to read but process is not yet terminated
# Only then it is safe to wait for the process to be finished
# NOTE: Actually cmd.poll() is always None here if no selectors are left
elif not selector.get_map() and cmd.poll() is None:
cmd.wait()
# The process is terminated. Since no pipes to read from are
# left, there is no need to call select() again.
break
cmd.stdout.close()
cmd.stderr.close()
selector.close()
rc = cmd.returncode
except (OSError, IOError) as e:

View File

@ -445,8 +445,8 @@ class Dnf5Module(YumDnf):
# done all we can do, something is just broken (auto-install isn't useful anymore with respawn, so it was removed)
self.module.fail_json(
msg="Could not import the dnf python module using {0} ({1}). "
"Please install `python3-dnf` or `python2-dnf` package or ensure you have specified the "
msg="Could not import the libdnf5 python module using {0} ({1}). "
"Please install python3-libdnf5 package or ensure you have specified the "
"correct ansible_python_interpreter. (attempted {2})".format(
sys.executable, sys.version.replace("\n", ""), system_interpreters
),
@ -629,11 +629,12 @@ class Dnf5Module(YumDnf):
if transaction.get_problems():
failures = []
for log in transaction.get_resolve_logs_as_strings():
if log.startswith("No match for argument") and self.state in {"install", "present", "latest"}:
failures.append("No package {} available.".format(log.rsplit(' ', 1)[-1]))
for log_event in transaction.get_resolve_logs():
if log_event.get_problem() == libdnf5.base.GoalProblem_NOT_FOUND and self.state in {"install", "present", "latest"}:
# NOTE dnf module compat
failures.append("No package {} available.".format(log_event.get_spec()))
else:
failures.append(log)
failures.append(log_event.to_string())
if transaction.get_problems() & libdnf5.base.GoalProblem_SOLVER_ERROR != 0:
msg = "Depsolve Error occurred"

View File

@ -19,6 +19,6 @@
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
__version__ = '2.15.0.dev0'
__version__ = '2.15.0b2'
__author__ = 'Ansible, Inc.'
__codename__ = "Ten Years Gone"

View File

@ -10,6 +10,10 @@ short_description: A random module
description:
- A random module.
- See O(foo.bar.baz#role:main:foo=bar) for how this is used in the P(foo.bar.baz#role)'s C(main) entrypoint.
- See L(the docsite,https://docs.ansible.com/ansible-core/devel/) for more information on ansible-core.
- This module is not related to the M(ansible.builtin.copy) module. HORIZONTALLINE You might also be interested
in R(ansible_python_interpreter, ansible_python_interpreter).
- Sometimes you have M(broken markup) that will result in error messages.
author:
- Ansible Core Team
version_added: 1.0.0

View File

@ -2,7 +2,12 @@
A random module. See `foo=bar' (of role foo.bar.baz, main
entrypoint) for how this is used in the [foo.bar.baz]'s `main'
entrypoint.
entrypoint. See the docsite <https://docs.ansible.com/ansible-
core/devel/> for more information on ansible-core. This module
is not related to the [ansible.builtin.copy] module.
------------- You might also be interested in
ansible_python_interpreter. Sometimes you have [broken markup]
that will result in error messages.
ADDED IN: version 1.0.0 of testns.testcol

View File

@ -13,7 +13,10 @@
},
"description": [
"A random module.",
"See O(foo.bar.baz#role:main:foo=bar) for how this is used in the P(foo.bar.baz#role)'s C(main) entrypoint."
"See O(foo.bar.baz#role:main:foo=bar) for how this is used in the P(foo.bar.baz#role)'s C(main) entrypoint.",
"See L(the docsite,https://docs.ansible.com/ansible-core/devel/) for more information on ansible-core.",
"This module is not related to the M(ansible.builtin.copy) module. HORIZONTALLINE You might also be interested in R(ansible_python_interpreter, ansible_python_interpreter).",
"Sometimes you have M(broken markup) that will result in error messages."
],
"filename": "./collections/ansible_collections/testns/testcol/plugins/modules/randommodule.py",
"has_action": false,

View File

@ -5,7 +5,7 @@
state: directory
- name: install simple collection from first accessible server
command: ansible-galaxy collection install namespace1.name1 {{ galaxy_verbosity }}
command: ansible-galaxy collection install namespace1.name1 -vvvv
environment:
ANSIBLE_COLLECTIONS_PATH: '{{ galaxy_dir }}/ansible_collections'
register: from_first_good_server
@ -30,6 +30,7 @@
- install_normal_files.files[1].path | basename in ['MANIFEST.json', 'FILES.json', 'README.md']
- install_normal_files.files[2].path | basename in ['MANIFEST.json', 'FILES.json', 'README.md']
- (install_normal_manifest.content | b64decode | from_json).collection_info.version == '1.0.9'
- 'from_first_good_server.stdout|regex_findall("has not signed namespace1\.name1")|length == 1'
- name: Remove the collection
file:

View File

@ -75,6 +75,23 @@ options:
a10:
description: O(foo.bar=1).
type: str
a11:
description: Something with suboptions.
type: dict
suboptions:
b1:
description:
- V(C\(foo\)).
- RV(bam).
- P(foo.bar#baz).
- P(foo.bar.baz).
- P(foo.bar.baz#woof).
- E(foo\(bar).
- O(bar).
- O(bar=bam).
- O(foo.bar=1).
type: str
'''
EXAMPLES = '''#'''
@ -103,5 +120,8 @@ if __name__ == '__main__':
a8=dict(),
a9=dict(),
a10=dict(),
a11=dict(type='dict', options=dict(
b1=dict(),
))
))
module.exit_json()

View File

@ -9,11 +9,16 @@ plugins/modules/invalid_yaml_syntax.py:0:0: missing-documentation: No DOCUMENTAT
plugins/modules/invalid_yaml_syntax.py:8:15: documentation-syntax-error: DOCUMENTATION is not valid YAML
plugins/modules/invalid_yaml_syntax.py:12:15: invalid-examples: EXAMPLES is not valid YAML
plugins/modules/invalid_yaml_syntax.py:16:15: return-syntax-error: RETURN is not valid YAML
plugins/modules/semantic_markup.py:0:0: invalid-documentation-markup: DOCUMENTATION.options.a2.description: Directive "V(C\(foo\))" contains unnecessarily quoted "(" for dictionary value @ data['options']['a2']['description']. Got 'V(C\\(foo\\)).'
plugins/modules/semantic_markup.py:0:0: invalid-documentation-markup: DOCUMENTATION.options.a4.description: Directive "P(foo.bar#baz)" must contain a FQCN; found "foo.bar" for dictionary value @ data['options']['a4']['description']. Got 'P(foo.bar#baz).'
plugins/modules/semantic_markup.py:0:0: invalid-documentation-markup: DOCUMENTATION.options.a5.description: Directive "P(foo.bar.baz)" must contain a "#" for dictionary value @ data['options']['a5']['description']. Got 'P(foo.bar.baz).'
plugins/modules/semantic_markup.py:0:0: invalid-documentation-markup: DOCUMENTATION.options.a11.suboptions.b1.description.0: While parsing "V(C\(" at index 1: Unnecessarily escaped "(" @ data['options']['a11']['suboptions']['b1']['description'][0]. Got 'V(C\\(foo\\)).'
plugins/modules/semantic_markup.py:0:0: invalid-documentation-markup: DOCUMENTATION.options.a11.suboptions.b1.description.2: While parsing "P(foo.bar#baz)" at index 1: Plugin name "foo.bar" is not a FQCN @ data['options']['a11']['suboptions']['b1']['description'][2]. Got 'P(foo.bar#baz).'
plugins/modules/semantic_markup.py:0:0: invalid-documentation-markup: DOCUMENTATION.options.a11.suboptions.b1.description.3: While parsing "P(foo.bar.baz)" at index 1: Parameter "foo.bar.baz" is not of the form FQCN#type @ data['options']['a11']['suboptions']['b1']['description'][3]. Got 'P(foo.bar.baz).'
plugins/modules/semantic_markup.py:0:0: invalid-documentation-markup: DOCUMENTATION.options.a11.suboptions.b1.description.4: Directive "P(foo.bar.baz#woof)" must contain a valid plugin type; found "woof" @ data['options']['a11']['suboptions']['b1']['description'][4]. Got 'P(foo.bar.baz#woof).'
plugins/modules/semantic_markup.py:0:0: invalid-documentation-markup: DOCUMENTATION.options.a11.suboptions.b1.description.5: While parsing "E(foo\(" at index 1: Unnecessarily escaped "(" @ data['options']['a11']['suboptions']['b1']['description'][5]. Got 'E(foo\\(bar).'
plugins/modules/semantic_markup.py:0:0: invalid-documentation-markup: DOCUMENTATION.options.a2.description: While parsing "V(C\(" at index 1: Unnecessarily escaped "(" for dictionary value @ data['options']['a2']['description']. Got 'V(C\\(foo\\)).'
plugins/modules/semantic_markup.py:0:0: invalid-documentation-markup: DOCUMENTATION.options.a4.description: While parsing "P(foo.bar#baz)" at index 1: Plugin name "foo.bar" is not a FQCN for dictionary value @ data['options']['a4']['description']. Got 'P(foo.bar#baz).'
plugins/modules/semantic_markup.py:0:0: invalid-documentation-markup: DOCUMENTATION.options.a5.description: While parsing "P(foo.bar.baz)" at index 1: Parameter "foo.bar.baz" is not of the form FQCN#type for dictionary value @ data['options']['a5']['description']. Got 'P(foo.bar.baz).'
plugins/modules/semantic_markup.py:0:0: invalid-documentation-markup: DOCUMENTATION.options.a6.description: Directive "P(foo.bar.baz#woof)" must contain a valid plugin type; found "woof" for dictionary value @ data['options']['a6']['description']. Got 'P(foo.bar.baz#woof).'
plugins/modules/semantic_markup.py:0:0: invalid-documentation-markup: DOCUMENTATION.options.a7.description: Directive "E(foo\(bar)" contains unnecessarily quoted "(" for dictionary value @ data['options']['a7']['description']. Got 'E(foo\\(bar).'
plugins/modules/semantic_markup.py:0:0: invalid-documentation-markup: DOCUMENTATION.options.a7.description: While parsing "E(foo\(" at index 1: Unnecessarily escaped "(" for dictionary value @ data['options']['a7']['description']. Got 'E(foo\\(bar).'
plugins/modules/semantic_markup.py:0:0: invalid-documentation-markup: Directive "O(bar)" contains a non-existing option "bar"
plugins/modules/semantic_markup.py:0:0: invalid-documentation-markup: Directive "O(bar=bam)" contains a non-existing option "bar"
plugins/modules/semantic_markup.py:0:0: invalid-documentation-markup: Directive "O(foo.bar=1)" contains a non-existing option "foo.bar"

View File

@ -1,6 +1,6 @@
base image=quay.io/ansible/base-test-container:4.1.0 python=3.11,2.7,3.5,3.6,3.7,3.8,3.9,3.10
default image=quay.io/ansible/default-test-container:7.10.0 python=3.11,2.7,3.5,3.6,3.7,3.8,3.9,3.10 context=collection
default image=quay.io/ansible/ansible-core-test-container:7.10.0 python=3.11,2.7,3.5,3.6,3.7,3.8,3.9,3.10 context=ansible-core
default image=quay.io/ansible/default-test-container:7.11.0 python=3.11,2.7,3.5,3.6,3.7,3.8,3.9,3.10 context=collection
default image=quay.io/ansible/ansible-core-test-container:7.11.0 python=3.11,2.7,3.5,3.6,3.7,3.8,3.9,3.10 context=ansible-core
alpine3 image=quay.io/ansible/alpine3-test-container:5.0.0 python=3.10 cgroup=none audit=none
centos7 image=quay.io/ansible/centos7-test-container:5.0.0 python=2.7 cgroup=v1-only
fedora37 image=quay.io/ansible/fedora37-test-container:5.0.0 python=3.11

View File

@ -1,3 +1,4 @@
jinja2 # ansible-core requirement
pyyaml # needed for collection_detail.py
voluptuous
antsibull-docs-parser==0.2.0

View File

@ -1,4 +1,5 @@
# edit "sanity.validate-modules.in" and generate with: hacking/update-sanity-requirements.py --test validate-modules
antsibull-docs-parser==0.2.0
Jinja2==3.1.2
MarkupSafe==2.1.2
PyYAML==6.0

View File

@ -33,6 +33,9 @@ from collections.abc import Mapping
from contextlib import contextmanager
from fnmatch import fnmatch
from antsibull_docs_parser import dom
from antsibull_docs_parser.parser import parse, Context
import yaml
from voluptuous.humanize import humanize_error
@ -79,10 +82,6 @@ from .schema import (
ansible_module_kwargs_schema,
doc_schema,
return_schema,
_SEM_OPTION_NAME,
_SEM_RET_VALUE,
_check_sem_quoting,
_parse_prefix,
)
from .utils import CaptureStd, NoArgsAnsibleModule, compare_unordered_lists, parse_yaml, parse_isodate
@ -1164,39 +1163,31 @@ class ModuleValidator(Validator):
return doc_info, doc
def _check_sem_option(self, directive, content):
try:
content = _check_sem_quoting(directive, content)
plugin_fqcn, plugin_type, option_link, option, value = _parse_prefix(directive, content)
except Exception:
# Validation errors have already been covered in the schema check
def _check_sem_option(self, part: dom.OptionNamePart, current_plugin: dom.PluginIdentifier) -> None:
if part.plugin is None or part.plugin != current_plugin:
return
if plugin_fqcn is not None:
if part.entrypoint is not None:
return
if tuple(option_link) not in self._all_options:
if tuple(part.link) not in self._all_options:
self.reporter.error(
path=self.object_path,
code='invalid-documentation-markup',
msg='Directive "%s" contains a non-existing option "%s"' % (directive, option)
msg='Directive "%s" contains a non-existing option "%s"' % (part.source, part.name)
)
def _check_sem_return_value(self, directive, content):
try:
content = _check_sem_quoting(directive, content)
plugin_fqcn, plugin_type, rv_link, rv, value = _parse_prefix(directive, content)
except Exception:
# Validation errors have already been covered in the schema check
def _check_sem_return_value(self, part: dom.ReturnValuePart, current_plugin: dom.PluginIdentifier) -> None:
if part.plugin is None or part.plugin != current_plugin:
return
if plugin_fqcn is not None:
if part.entrypoint is not None:
return
if tuple(rv_link) not in self._all_return_values:
if tuple(part.link) not in self._all_return_values:
self.reporter.error(
path=self.object_path,
code='invalid-documentation-markup',
msg='Directive "%s" contains a non-existing return value "%s"' % (directive, rv)
msg='Directive "%s" contains a non-existing return value "%s"' % (part.source, part.name)
)
def _validate_semantic_markup(self, object):
def _validate_semantic_markup(self, object) -> None:
# Make sure we operate on strings
if is_iterable(object):
for entry in object:
@ -1205,10 +1196,19 @@ class ModuleValidator(Validator):
if not isinstance(object, string_types):
return
for m in _SEM_OPTION_NAME.finditer(object):
self._check_sem_option(m.group(0), m.group(1))
for m in _SEM_RET_VALUE.finditer(object):
self._check_sem_return_value(m.group(0), m.group(1))
if self.collection:
fqcn = f'{self.collection_name}.{self.name}'
else:
fqcn = f'ansible.builtin.{self.name}'
current_plugin = dom.PluginIdentifier(fqcn=fqcn, type=self.plugin_type)
for par in parse(object, Context(current_plugin=current_plugin), errors='message', add_source=True):
for part in par:
# Errors are already covered during schema validation, we only check for option and
# return value references
if part.type == dom.PartType.OPTION_NAME:
self._check_sem_option(part, current_plugin)
if part.type == dom.PartType.RETURN_VALUE:
self._check_sem_return_value(part, current_plugin)
def _validate_semantic_markup_collect(self, destination, sub_key, data, all_paths):
if not isinstance(data, dict):

View File

@ -11,7 +11,7 @@ from ansible.module_utils.compat.version import StrictVersion
from functools import partial
from urllib.parse import urlparse
from voluptuous import ALLOW_EXTRA, PREVENT_EXTRA, All, Any, Invalid, Length, Required, Schema, Self, ValueInvalid, Exclusive
from voluptuous import ALLOW_EXTRA, PREVENT_EXTRA, All, Any, Invalid, Length, MultipleInvalid, Required, Schema, Self, ValueInvalid, Exclusive
from ansible.constants import DOCUMENTABLE_PLUGINS
from ansible.module_utils.six import string_types
from ansible.module_utils.common.collections import is_iterable
@ -20,6 +20,9 @@ from ansible.parsing.quoting import unquote
from ansible.utils.version import SemanticVersion
from ansible.release import __version__
from antsibull_docs_parser import dom
from antsibull_docs_parser.parser import parse, Context
from .utils import parse_isodate
list_string_types = list(string_types)
@ -81,57 +84,8 @@ def date(error_code=None):
return Any(isodate, error_code=error_code)
_MODULE = re.compile(r"\bM\(([^)]+)\)")
_PLUGIN = re.compile(r"\bP\(([^)]+)\)")
_LINK = re.compile(r"\bL\(([^)]+)\)")
_URL = re.compile(r"\bU\(([^)]+)\)")
_REF = re.compile(r"\bR\(([^)]+)\)")
_SEM_PARAMETER_STRING = r"\(((?:[^\\)]+|\\.)+)\)"
_SEM_OPTION_NAME = re.compile(r"\bO" + _SEM_PARAMETER_STRING)
_SEM_OPTION_VALUE = re.compile(r"\bV" + _SEM_PARAMETER_STRING)
_SEM_ENV_VARIABLE = re.compile(r"\bE" + _SEM_PARAMETER_STRING)
_SEM_RET_VALUE = re.compile(r"\bRV" + _SEM_PARAMETER_STRING)
_UNESCAPE = re.compile(r"\\(.)")
_CONTENT_LINK_SPLITTER_RE = re.compile(r'(?:\[[^\]]*\])?\.')
_CONTENT_LINK_END_STUB_RE = re.compile(r'\[[^\]]*\]$')
_FQCN_TYPE_PREFIX_RE = re.compile(r'^([^.]+\.[^.]+\.[^#]+)#([a-z]+):(.*)$')
_IGNORE_MARKER = 'ignore:'
_IGNORE_STRING = '(ignore)'
_VALID_PLUGIN_TYPES = set(DOCUMENTABLE_PLUGINS)
def _check_module_link(directive, content):
if not FULLY_QUALIFIED_COLLECTION_RESOURCE_RE.match(content):
raise _add_ansible_error_code(
Invalid('Directive "%s" must contain a FQCN' % directive), 'invalid-documentation-markup')
def _check_plugin_link(directive, content):
if '#' not in content:
raise _add_ansible_error_code(
Invalid('Directive "%s" must contain a "#"' % directive), 'invalid-documentation-markup')
plugin_fqcn, plugin_type = content.split('#', 1)
if not FULLY_QUALIFIED_COLLECTION_RESOURCE_RE.match(plugin_fqcn):
raise _add_ansible_error_code(
Invalid('Directive "%s" must contain a FQCN; found "%s"' % (directive, plugin_fqcn)),
'invalid-documentation-markup')
if plugin_type not in _VALID_PLUGIN_TYPES:
raise _add_ansible_error_code(
Invalid('Directive "%s" must contain a valid plugin type; found "%s"' % (directive, plugin_type)),
'invalid-documentation-markup')
def _check_link(directive, content):
if ',' not in content:
raise _add_ansible_error_code(
Invalid('Directive "%s" must contain a comma' % directive), 'invalid-documentation-markup')
idx = content.rindex(',')
title = content[:idx]
url = content[idx + 1:].lstrip(' ')
_check_url(directive, url)
# Roles can also be referenced by semantic markup
_VALID_PLUGIN_TYPES = set(DOCUMENTABLE_PLUGINS + ('role', ))
def _check_url(directive, content):
@ -139,67 +93,10 @@ def _check_url(directive, content):
parsed_url = urlparse(content)
if parsed_url.scheme not in ('', 'http', 'https'):
raise ValueError('Schema must be HTTP, HTTPS, or not specified')
except ValueError as exc:
raise _add_ansible_error_code(
Invalid('Directive "%s" must contain an URL' % directive), 'invalid-documentation-markup')
def _check_ref(directive, content):
if ',' not in content:
raise _add_ansible_error_code(
Invalid('Directive "%s" must contain a comma' % directive), 'invalid-documentation-markup')
def _check_sem_quoting(directive, content):
for m in _UNESCAPE.finditer(content):
if m.group(1) not in ('\\', ')'):
raise _add_ansible_error_code(
Invalid('Directive "%s" contains unnecessarily quoted "%s"' % (directive, m.group(1))),
'invalid-documentation-markup')
return _UNESCAPE.sub(r'\1', content)
def _parse_prefix(directive, content):
value = None
if '=' in content:
content, value = content.split('=', 1)
m = _FQCN_TYPE_PREFIX_RE.match(content)
if m:
plugin_fqcn = m.group(1)
plugin_type = m.group(2)
content = m.group(3)
if not FULLY_QUALIFIED_COLLECTION_RESOURCE_RE.match(plugin_fqcn):
raise _add_ansible_error_code(
Invalid('Directive "%s" must contain a FQCN; found "%s"' % (directive, plugin_fqcn)),
'invalid-documentation-markup')
if plugin_type not in _VALID_PLUGIN_TYPES:
raise _add_ansible_error_code(
Invalid('Directive "%s" must contain a valid plugin type; found "%s"' % (directive, plugin_type)),
'invalid-documentation-markup')
elif content.startswith(_IGNORE_MARKER):
content = content[len(_IGNORE_MARKER):]
plugin_fqcn = plugin_type = _IGNORE_STRING
else:
plugin_fqcn = plugin_type = None
if ':' in content or '#' in content:
raise _add_ansible_error_code(
Invalid('Directive "%s" contains wrongly specified FQCN/plugin type' % directive),
'invalid-documentation-markup')
content_link = _CONTENT_LINK_SPLITTER_RE.split(content)
for i, part in enumerate(content_link):
if i == len(content_link) - 1:
part = _CONTENT_LINK_END_STUB_RE.sub('', part)
content_link[i] = part
if '.' in part or '[' in part or ']' in part:
raise _add_ansible_error_code(
Invalid('Directive "%s" contains invalid name "%s"' % (directive, content)),
'invalid-documentation-markup')
return plugin_fqcn, plugin_type, content_link, content, value
def _check_sem_option_return_value(directive, content):
content = _check_sem_quoting(directive, content)
_parse_prefix(directive, content)
return []
except ValueError:
return [_add_ansible_error_code(
Invalid('Directive %s must contain a valid URL' % directive), 'invalid-documentation-markup')]
def doc_string(v):
@ -207,35 +104,55 @@ def doc_string(v):
if not isinstance(v, string_types):
raise _add_ansible_error_code(
Invalid('Must be a string'), 'invalid-documentation')
for m in _MODULE.finditer(v):
_check_module_link(m.group(0), m.group(1))
for m in _PLUGIN.finditer(v):
_check_plugin_link(m.group(0), m.group(1))
for m in _LINK.finditer(v):
_check_link(m.group(0), m.group(1))
for m in _URL.finditer(v):
_check_url(m.group(0), m.group(1))
for m in _REF.finditer(v):
_check_ref(m.group(0), m.group(1))
for m in _SEM_OPTION_NAME.finditer(v):
_check_sem_option_return_value(m.group(0), m.group(1))
for m in _SEM_OPTION_VALUE.finditer(v):
_check_sem_quoting(m.group(0), m.group(1))
for m in _SEM_ENV_VARIABLE.finditer(v):
_check_sem_quoting(m.group(0), m.group(1))
for m in _SEM_RET_VALUE.finditer(v):
_check_sem_option_return_value(m.group(0), m.group(1))
errors = []
for par in parse(v, Context(), errors='message', strict=True, add_source=True):
for part in par:
if part.type == dom.PartType.ERROR:
errors.append(_add_ansible_error_code(Invalid(part.message), 'invalid-documentation-markup'))
if part.type == dom.PartType.URL:
errors.extend(_check_url('U()', part.url))
if part.type == dom.PartType.LINK:
errors.extend(_check_url('L()', part.url))
if part.type == dom.PartType.MODULE:
if not FULLY_QUALIFIED_COLLECTION_RESOURCE_RE.match(part.fqcn):
errors.append(_add_ansible_error_code(Invalid(
'Directive "%s" must contain a FQCN; found "%s"' % (part.source, part.fqcn)),
'invalid-documentation-markup'))
if part.type == dom.PartType.PLUGIN:
if not FULLY_QUALIFIED_COLLECTION_RESOURCE_RE.match(part.plugin.fqcn):
errors.append(_add_ansible_error_code(Invalid(
'Directive "%s" must contain a FQCN; found "%s"' % (part.source, part.plugin.fqcn)),
'invalid-documentation-markup'))
if part.plugin.type not in _VALID_PLUGIN_TYPES:
errors.append(_add_ansible_error_code(Invalid(
'Directive "%s" must contain a valid plugin type; found "%s"' % (part.source, part.plugin.type)),
'invalid-documentation-markup'))
if part.type == dom.PartType.OPTION_NAME:
if part.plugin is not None and not FULLY_QUALIFIED_COLLECTION_RESOURCE_RE.match(part.plugin.fqcn):
errors.append(_add_ansible_error_code(Invalid(
'Directive "%s" must contain a FQCN; found "%s"' % (part.source, part.plugin.fqcn)),
'invalid-documentation-markup'))
if part.plugin is not None and part.plugin.type not in _VALID_PLUGIN_TYPES:
errors.append(_add_ansible_error_code(Invalid(
'Directive "%s" must contain a valid plugin type; found "%s"' % (part.source, part.plugin.type)),
'invalid-documentation-markup'))
if part.type == dom.PartType.RETURN_VALUE:
if part.plugin is not None and not FULLY_QUALIFIED_COLLECTION_RESOURCE_RE.match(part.plugin.fqcn):
errors.append(_add_ansible_error_code(Invalid(
'Directive "%s" must contain a FQCN; found "%s"' % (part.source, part.plugin.fqcn)),
'invalid-documentation-markup'))
if part.plugin is not None and part.plugin.type not in _VALID_PLUGIN_TYPES:
errors.append(_add_ansible_error_code(Invalid(
'Directive "%s" must contain a valid plugin type; found "%s"' % (part.source, part.plugin.type)),
'invalid-documentation-markup'))
if len(errors) == 1:
raise errors[0]
if errors:
raise MultipleInvalid(errors)
return v
def doc_string_or_strings(v):
"""Match a documentation string, or list of strings."""
if isinstance(v, string_types):
return doc_string(v)
if isinstance(v, (list, tuple)):
return [doc_string(vv) for vv in v]
raise _add_ansible_error_code(
Invalid('Must be a string or list of strings'), 'invalid-documentation')
doc_string_or_strings = Any(doc_string, [doc_string])
def is_callable(v):

View File

@ -18,6 +18,11 @@ def validate_modules() -> None:
sys.modules['voluptuous'] = voluptuous = mock.MagicMock()
sys.modules['voluptuous.humanize'] = voluptuous.humanize = mock.MagicMock()
# Mock out antsibull_docs_parser to facilitate testing without it, since tests aren't covering anything that uses it.
sys.modules['antsibull_docs_parser'] = antsibull_docs_parser = mock.MagicMock()
sys.modules['antsibull_docs_parser.parser'] = antsibull_docs_parser.parser = mock.MagicMock()
@pytest.mark.parametrize('cstring,cexpected', [
['if type(foo) is Bar', True],

View File

@ -147,7 +147,7 @@ class TestRunCommandArgs:
for (arg, cmd_lst, cmd_str), sh in product(ARGS_DATA, (True, False))),
indirect=['stdin'])
def test_args(self, cmd, expected, shell, rc_am):
rc_am.run_command(cmd, use_unsafe_shell=shell)
rc_am.run_command(cmd, use_unsafe_shell=shell, prompt_regex='i_dont_exist')
assert rc_am._subprocess.Popen.called
args, kwargs = rc_am._subprocess.Popen.call_args
assert args == (expected, )
@ -163,17 +163,17 @@ class TestRunCommandArgs:
class TestRunCommandCwd:
@pytest.mark.parametrize('stdin', [{}], indirect=['stdin'])
def test_cwd(self, mocker, rc_am):
rc_am.run_command('/bin/ls', cwd='/new')
rc_am.run_command('/bin/ls', cwd='/new', prompt_regex='i_dont_exist')
assert rc_am._subprocess.Popen.mock_calls[0][2]['cwd'] == b'/new'
@pytest.mark.parametrize('stdin', [{}], indirect=['stdin'])
def test_cwd_relative_path(self, mocker, rc_am):
rc_am.run_command('/bin/ls', cwd='sub-dir')
rc_am.run_command('/bin/ls', cwd='sub-dir', prompt_regex='i_dont_exist')
assert rc_am._subprocess.Popen.mock_calls[0][2]['cwd'] == b'/home/foo/sub-dir'
@pytest.mark.parametrize('stdin', [{}], indirect=['stdin'])
def test_cwd_not_a_dir(self, mocker, rc_am):
rc_am.run_command('/bin/ls', cwd='/not-a-dir')
rc_am.run_command('/bin/ls', cwd='/not-a-dir', prompt_regex='i_dont_exist')
assert rc_am._subprocess.Popen.mock_calls[0][2]['cwd'] == b'/not-a-dir'
@pytest.mark.parametrize('stdin', [{}], indirect=['stdin'])
@ -212,14 +212,14 @@ class TestRunCommandRc:
@pytest.mark.parametrize('stdin', [{}], indirect=['stdin'])
def test_check_rc_false(self, rc_am):
rc_am._subprocess.Popen.return_value.returncode = 1
(rc, _, _) = rc_am.run_command('/bin/false', check_rc=False)
(rc, _, _) = rc_am.run_command('/bin/false', check_rc=False, prompt_regex='i_dont_exist')
assert rc == 1
@pytest.mark.parametrize('stdin', [{}], indirect=['stdin'])
def test_check_rc_true(self, rc_am):
rc_am._subprocess.Popen.return_value.returncode = 1
with pytest.raises(SystemExit):
rc_am.run_command('/bin/false', check_rc=True)
rc_am.run_command('/bin/false', check_rc=True, prompt_regex='i_dont_exist')
assert rc_am.fail_json.called
args, kwargs = rc_am.fail_json.call_args
assert kwargs['rc'] == 1
@ -228,7 +228,7 @@ class TestRunCommandRc:
class TestRunCommandOutput:
@pytest.mark.parametrize('stdin', [{}], indirect=['stdin'])
def test_text_stdin(self, rc_am):
(rc, stdout, stderr) = rc_am.run_command('/bin/foo', data='hello world')
(rc, stdout, stderr) = rc_am.run_command('/bin/foo', data='hello world', prompt_regex='i_dont_exist')
assert rc_am._subprocess.Popen.return_value.stdin.getvalue() == b'hello world\n'
@pytest.mark.parametrize('stdin', [{}], indirect=['stdin'])
@ -237,7 +237,7 @@ class TestRunCommandOutput:
SpecialBytesIO(b'hello', fh=mocker.sentinel.stdout),
mocker.sentinel.stderr:
SpecialBytesIO(b'', fh=mocker.sentinel.stderr)}
(rc, stdout, stderr) = rc_am.run_command('/bin/cat hello.txt')
(rc, stdout, stderr) = rc_am.run_command('/bin/cat hello.txt', prompt_regex='i_dont_exist')
assert rc == 0
# module_utils function. On py3 it returns text and py2 it returns
# bytes because it's returning native strings
@ -251,7 +251,7 @@ class TestRunCommandOutput:
mocker.sentinel.stderr:
SpecialBytesIO(u'لرئيسية'.encode('utf-8'),
fh=mocker.sentinel.stderr)}
(rc, stdout, stderr) = rc_am.run_command('/bin/something_ugly')
(rc, stdout, stderr) = rc_am.run_command('/bin/something_ugly', prompt_regex='i_dont_exist')
assert rc == 0
# module_utils function. On py3 it returns text and py2 it returns
# bytes because it's returning native strings