Commit Graph

12165 Commits

Author SHA1 Message Date
3ec0850df9 Support packaging and importlib.metadata for pip module (#80881) 2023-09-05 16:11:18 -05:00
dd79c49a4d fix various Jinja plugin caching issues (#79781)
* fix various Jinja plugin caching issues

* consolidate the wrapper plugin cache
* remove redundant cache in J2 filter/test interceptor

* intra-template loader bypass

* fix early exits swallowing some exception detail

* misc comment cleanup
2023-09-05 13:32:36 -07:00
786a8abee6 yum/dnf/dnf5/zypper documentation - fix grammatical error (#81601) 2023-08-31 15:14:27 -04:00
1cc5efa77b tarfile: Handle deprecation warning for extract and extractall (#81545)
* Python 3.11.4 introduces a new parameter 'filter' in extract and
extractall in tarfile. Handle deprecation warning message emitted
in Python 3.12.
* added probing mechanism in ansible-galaxy code to detect broken
data filter implementation in tarfile.

Fixes: #80832

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
Co-authored-by: Matt Clay <matt@mystile.com>
2023-08-31 12:02:48 -07:00
5a059b81c8 ansible-test - Fix Python coverage stub generation (#81611)
As of coverage 7.1.0, files without arcs are not generated.

To work around this, an empty (0, 0) arc is used for each file instead.

This is a follow-up to https://github.com/ansible/ansible/pull/81077

ci_coverage
ci_complete
2023-08-31 10:53:10 -07:00
e1e0e2709c ansible-test - Enable thread code coverage (#81604)
ci_complete
ci_coverage
2023-08-30 14:39:47 -07:00
261e5ce381 ansible-test - Update mypy to 1.5.1 (#81602) 2023-08-30 10:39:25 -07:00
c59bcbe627 Bump coverage.py to v7.3.0 in ansible-test (#81077) 2023-08-30 08:58:45 -07:00
65a96daaf4 Fix typos in url lookup plugin options (#81587) 2023-08-29 16:27:09 -05:00
509be19357 Fix nested jinja statements in integration tests (#81591) 2023-08-29 14:33:19 -05:00
bdaa091b33 Add warnings for illegal file names in role (#81555)
Co-authored-by: Aleksey Tsalolikhin <atsaloli.tech@gmail.com>
2023-08-28 14:54:08 -04:00
4ab5ecbe81 dnf - fix for a package from URI and update_only (#81568)
Fixes #81376
2023-08-28 10:48:45 +02:00
da63f32d59 script: add argument validation (#81469)
partially fixes: #81349

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2023-08-25 10:27:26 -07:00
7865b198d2 PowerShell - Improve error checking (#80984)
Improves the error checking when running PowerShell modules using
Ansible.ModuleUtils.Legacy. It will only return an rc of 1 if both the
PowerShell module runner signalled an error occurred and those error
records were present in the output. This should reduce some false
positive errors when using the older module style.
2023-08-25 05:24:02 +10:00
f3976117fb PowerShell - remove uneeded dotnet code for future compatibility (#81472) 2023-08-25 05:23:48 +10:00
116948cd14 user - set current expiration correctly when no shadow entry exists (#75194) 2023-08-23 11:18:57 -07:00
2e6d849bdb apt: ignore fail_on_autoremove and allow_downgrade when using aptitude (#81445)
* apt: ignore fail_on_autoremove and allow_downgrade when using aptitude

* fail_on_autoremove (--no-remove) and allow_downgrade (--allow-downgrades)
  parameters are only valid for apt-get and not for aptitude. Ignore them when
  aptitude is detected and used.

Fixes: #77868
2023-08-23 08:42:03 -07:00
863e2571db debconf: idempotency for password question (#81484)
* Gather value of password using debconf-get-selections command,
  use this information for idempotency.

Fixes: #47676

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2023-08-21 18:25:03 -07:00
6627ba9ace Unit test cleanup (#81556)
* Fix cleanup_tmp_file unit tests

* Simplify the problematic wcwidth chars unit test
2023-08-21 15:54:03 -07:00
f28e32c063 ansible-test - Limit deprecated check to core (#81552)
Using `# deprecated:` comment checks in collections would effectively limit those collections to a single version of ansible-core.
2023-08-21 12:58:09 -07:00
c69c83c962 Fix macos defaults (#79999) 2023-08-21 10:02:47 -07:00
390e508d27 ansible-test - Always use managed entry points (#81537) 2023-08-17 19:13:29 -07:00
a48feb4cfc "retries" without "until": retry until success (#81531)
Fixes #20802
2023-08-17 15:17:26 -04:00
98f1627817 include_role: expose vars from parent roles to role's handlers (#81524)
* include_role: expose vars from parent roles to role's handlers

Fixes #80459
2023-08-17 15:14:20 -04:00
ca08261f08 Add ability to filter find on mode (#81485) 2023-08-15 11:58:19 -05:00
0cba3b7504 Last handler with same name wins for listen too (#81358)
Fixes #49371
Fixes #81013
2023-08-15 15:03:56 +02:00
bd3ffbe109 fix incorrect ansible_managed formatting (#79129)
Ansible breaks configs if file name could be parsed as jinja template
or contains `%` chars.
Especially `%n`[ame%] which is a line break pattern according to [strftime (3)](https://manpages.debian.org/bullseye/manpages-dev/strftime.3.en.html)
2023-08-14 09:59:40 -04:00
47ab59753c Clean up release script (#81488)
* Enable mypy for the entire packaging directory

* Return CompletedProcess only when capturing output

This allows stdout/stderr on CompletedProcess to be `str` instead of `str | None`.
The unused args on CompletedProcess have been removed.
Overload type hints have been added to reflect these changes.

* Relax return type on ensure_venv

This improves consistency with its usage, since `run` accepts `env` of `dict[str, t.Any]`.
Also removed unnecssary `str()` usage when updating `env`.

* Fix type hint on suppress_when

* Fix callable annotation

* Add type hint for command_parser

PyCharm complains about using a protected member, and also that it can't find the type in the type stubs.
However, mypy properly recognizes the type.

* Avoid unnecessary TypeVar usage
2023-08-10 13:39:37 -07:00
d0699cb44a Add unit tests for module_utils.compat.datetime (#81483) 2023-08-09 12:24:10 -07:00
580b87252c Remove unreachable code in password lookup test (#81482) 2023-08-09 12:23:58 -07:00
726d9a5fcc Fix constructed inventory plugin unit test (#81481) 2023-08-09 12:23:47 -07:00
553f51e728 Revert logic to use Popen.communicate (#80874)
* Back out use of communicate, add better comments, add bufsize, and align with subprocess._communicate

* tests

* re-order logic slightly

* more comments

* loopty loop

* yet another comment

* Revert "yet another comment"

This reverts commit 96cd8ada5fa0441b92f2298bdaa6cb40594847d2.

* Revert "loopty loop"

This reverts commit 96ea066f6a7d18902c04a14f18dd79b38e56f5e7.

* ci_complete

* Copy in comment too

* Wording updates

Co-authored-by: Matt Davis <6775756+nitzmahone@users.noreply.github.com>

* Back out bufsize

---------

Co-authored-by: Matt Davis <6775756+nitzmahone@users.noreply.github.com>
2023-08-09 11:09:43 -07:00
1c765a6afc restore conditional lookup nerfing (#81460)
* a recent optimization lost the unsafe lookup disable behavior when templating conditionals with inline templates that referred to untrusted values
* added regression test to catch this case
2023-08-09 09:25:20 -07:00
fa5fe8a7db Bump test container versions to latest (#81471)
Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2023-08-08 19:53:04 -07:00
493c678795 Sanity: Bump version to match Python 3.12 (#81399)
Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2023-08-08 09:05:46 -07:00
f3a15a4a95 filters vault/unvault fix vault_id parameter usage (#81422)
* vault/unvault filters, fixed id field to match documented.

fixes #81420

Co-authored-by: Felix Fontein <felix@fontein.de>
2023-08-04 17:50:57 -04:00
a1569ea4ca iptables chain creation does not populate with a rule (#80257)
* iptables chain creation does not populate with a rule

fixes #80256

* Add changelog fragment

* Add rules and flush chain during integration tests

* Check chain rule on comment

* Update test/integration/targets/iptables/tasks/chain_management.yml
2023-08-04 13:59:21 -04:00
f10d11bcdc dpkg_selections: Check if package exists before selection operation (#81406)
* dpkg_selections: Check if the package exists before the selection operation

Fixes: #81404

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2023-08-03 14:01:20 -07:00
95fdd555b3 galaxy: Cross check the collection type (#81423)
* User-provided collection type might differ from collection
  source. Cross-check the type before proceeding

Fixes: #79463

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2023-08-03 13:59:59 -07:00
f894ce89b4 Overhaul package-data sanity test (#81427)
The sanity test now only inspects the sdist and wheel instead of trying to install the sdist using setup.py.
2023-08-03 13:24:25 -07:00
f5431321a2 password_hash - fix bcrypt algorithm when passlib is not installed (#81385) 2023-08-03 14:32:42 -04:00
2ebeb43d6f ansible-galaxy - improve ignoring multiple signature status codes (#77610)
* ansible-galaxy - improve ignoring multiple signature status codes when using --ignore-signature-status-code

* fix backwards compatibility by adding a new plural option instead, and hide the singular from --help
2023-08-03 13:00:07 +00:00
c525514994 ansible-test - Update source layout detection (#81418) 2023-08-02 20:24:13 -07:00
d1cd06073f Extend setup_collections timeout to 3 minutes (#81408) 2023-08-02 10:43:21 -07:00
b9daa6891f Remove unused sanity test code (#81398) 2023-08-01 14:08:01 -07:00
11e261b54f CI: remove FreeBSD 12.4 from test matrix (#81315)
Fixes: #80417

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2023-08-01 13:37:26 -07:00
691c8e8603 Omit pre-built man pages from sdist (#81395)
Since man pages aren't accessible to users after a `pip install`, there's no need to include them in the sdist.
This change makes it trivial to build man pages from source, which makes them much easier to iterate on.
It also simplifies creation and testing of the sdist, since it no longer requires building man pages.

The new `packaging/cli-doc/build.py` script can generate both man pages and RST documentation.
This supports inclusion on the docs site without a dependency on `ansible-core` internals.
Having a single implementation for both simplifies keeping the two formats in sync.
2023-08-01 12:48:01 -07:00
6d1f85bbe9 ansible-test: remove alpine 3.17 (#81124) 2023-08-01 11:54:33 -07:00
d5d1c27bf3 Add option to blockinfile to wrap inserted block with blank lines (#81083)
* Add new blockinfile options 'prepend_newline' and 'append_newline' to wrap inserted block with blank lines
2023-07-26 17:38:07 -04:00
4c41562270 remove deprecated datetime.datetime methods (#81323)
* Remove datetime.datetime.utcfromtimestamp and datetime.datetime.uctnow
  from controller code since they are deprecated in Python 3.12.

* Update target side code to use new utcfromtimestamp and utcnow utils in ansible.module_utils.compat.datetime that return aware datetime objects on Python 2.7 and 3.

Co-authored-by: Matt Clay <matt@mystile.com>
2023-07-26 17:26:33 -04:00