Commit Graph

12779 Commits (244c2f06edd3331495de27ecce2066cfa49d1e00)

Author SHA1 Message Date
Martin Krizek 244c2f06ed
Add ssh-agent launching, and ssh-agent python client (#84754)
* Add ssh-agent launching, and ssh-agent python client

* Move things around, is this better??

* docs

* postpone creating dir after bin lookup

* fix method name

* changelog ssh agent

* address reviews

* fix typing

* do not redefine public_key

* typing

* more typing

* Catch OSError when starting ssh agent

* likely copy pasted old code

* var type fix

* why is this needed?

ci_complete

* ignoring the change for now

* write out pub key file atomically

* defensive timeout for the socket

* _populate_agent docstring

* do not allow setting these in config

* check expected length before slicing blobs

* test all key types

* remove lock/unlock functionality

* docstring

* private _ssh_agent

* .

* launch agent in cli and ansible_ssh_*

* additional info for ssh-agent comment

* Add tests for remove and remove_all

* comment on os.rename

* hopefully mitigate agent startup/delays problems

* exceptions

* unused import

* fix sanity

* perf

---------

Co-authored-by: Matt Martz <matt@sivel.net>
8 months ago
Brian Coca 4bc4030988
ansible-pull fix adhoc output inconsistencies on changed (#84869)
Two fixes for single bug:
  - ignore callback changes for adhoc
  - allow 'yaml' change matching
---------

Co-authored-by: Abhijeet Kasurde <akasurde@redhat.com>
8 months ago
Matt Martz fd76cc2821
Revert "basic: remember the user sensitive information to use later (#84699)" (#84959)
This reverts commit 19e9f3dae2.
8 months ago
Abhijeet Kasurde 5347d4d4fc
distro: detect debian for OS_FAMILY for LMDE 6 (#84941)
Fixes: #84934

Signed-off-by: Abhijeet Kasurde <Akasurde@redhat.com>
8 months ago
Abhijeet Kasurde 19e9f3dae2
basic: remember the user sensitive information to use later (#84699)
* Git allows embedding username and password in repo URL for
  https authentication. This may lead to exposing the user sensitive
  information to logs and unautheticated users.
  Adding no_log will partially solve this.
* Added documentation warning user about URL embedded with username
  and password.
* Added logic to remember user sensitive information for later sanitization

Fixes: #84557

Signed-off-by: Abhijeet Kasurde <Akasurde@redhat.com>
8 months ago
Matt Clay 462affa7c4
Clean up interpreter discovery (#84394)
* Clean up interpreter discovery

- Deprecated `auto_legacy` and `auto_legacy_silent`
- Removed obsolete platform fallback config and logic
- Replaced unit tests with integration tests
- Increased test coverage
8 months ago
Jordan Borean b7d76a93b2
Fix up coverage with async on Windows (#84917)
Fixes the coverage collection for Windows and async tasks. This ensures
the async task still has access to the PSHost so that it can access the
runspace debugger tasks on the host.
8 months ago
Abhijeet Kasurde 2a4b1c8248
ansible-config: Dump galaxy server config in proper JSON format (#84912)
Fixes: #84840

Signed-off-by: Abhijeet Kasurde <Akasurde@redhat.com>
8 months ago
Jordan Borean 7d0886457a
Windows Exec Runner Update (#84868)
Updates the Windows exec runner in preparation for the WDAC changes.
This new process is designed to improve the way modules are run by
Windows and expose common functionality to run PowerShell code in a
common environment. It also includes futher changes to improve the error
handling to make it easier to see where an error occurred in the running
code.
8 months ago
Matt Clay b3d21e3ad2
Fix apt and dpkg_selections tests (#84900)
* Fix apt and dpkg_selections tests

The tests now support aarch64.
They also have reduced dependencies on URLs hosted on third-party servers.

* Skip tests on unsupported platforms

* Use same package version for both tests

* Fix multi-arch support for Ubuntu 22.04
8 months ago
Matt Clay 87422526f5
Expand tests for apt_repository (#84904) 8 months ago
Anvit Pusalkar 1e5aac7b4f
Set IPv4 and IPv6 simultaneously (#84829) 9 months ago
Matt Clay e53c12fe2b
ansible-test - Update base/default containers (#84874) 9 months ago
Matt Clay f4aafe1a94
ansible-test - Update pylint requirement (#84872) 9 months ago
Matt Clay 35665db4ed
Miscellaneous integration test fixes (#84871) 9 months ago
Matt Clay 091994a477
ansible-test - Update sanity test requirements (#84866) 9 months ago
Matt Clay b7a5411d8b
ansible-test - Improve pep8 compat with black (#84867) 9 months ago
Matt Clay 7e7946b60d
Require Jinja2 3.1.0 or later (#84864) 9 months ago
Matt Clay ad5cf37625
Add typing_extensions for core unit tests on <3.11 (#84865) 9 months ago
Brian Coca 0d4f00f5c8
needed intesect, not difference (#84839)
fixes #84750

Added tests to verify output when using smart + others
9 months ago
Robert Muir 61a6222e0e
uri: form location correctly from relative redirect (#84541)
* uri: form location correctly from relative redirect

Previously, the original URL would be combined with the relative location incorrectly, especially for URL of any complexity.

Add simple tests demonstrating the problem that fail without the fix

* fix pylint error, import the method similar to other uri methods

* add changelog fragment

Signed-off-by: Abhijeet Kasurde <Akasurde@redhat.com>
9 months ago
Jordan Borean 101e2eb19a
windows async - refactor async wrapper code (#84712)
Refactor the async wrapper and watchdog scripts for Windows. This
attempts to avoid WMI on connection plugins that allow breaking away
from a job like winrm and ssh as an optimisation and changes how WMI is
used so that we can get the error details on a failed process more
easily.

These changes are being made also in preparation for the WDAC
implementation that requires this new execution model where input needs
to be provided through stdin.
9 months ago
Matt Martz 8127abbc29
Don't inherit stdio (#82770) 9 months ago
Matt Martz 3684b4824d
Remove reliance on `sshpass` and utilize `SSH_ASKPASS` (#83936)
* Add SSH_ASKPASS as an alternative means to provide ssh with passwords
9 months ago
Matt Clay 4efb01c2f3
ansible-test - Replace FreeBSD 13.4 with 13.5 (#84812) 9 months ago
🇺🇦 Sviatoslav Sydorenko (Святослав Сидоренко) df08ed3ef3
🔥 Remove Python 2 datetime compat fallbacks
This patch marks the `ansible.module_utils.compat.datetime` module as deprecated, including `UTC`, `utcfromtimestamp()`  and `utcnow` shims that it provides, scheduling its removal for v2.21.

It also replaces any uses of the compatibility helpers with non-deprecated calls to CPython stdlib.

PR #81874

Co-authored-by: Matt Clay <matt@mystile.com>
9 months ago
Abhijeet Kasurde 50b4e0d279
facts: use pagesize for darwin (#84779)
Fixes: #84773

Signed-off-by: Abhijeet Kasurde <Akasurde@redhat.com>
9 months ago
Martin Krizek 7fbaf6cfcf
dnf5: fix is_installed check for provided packages (#84802)
Fixes #84578
9 months ago
Martin Krizek 09391f38f0
dnf tests: unique environment/group name (#84785)
Prevents `Group state for \"customenvgroup\" not found` error which may
or may not be a regression in dnf5. Just name groups/envs uniquely to
workaround the issue.
9 months ago
Abhijeet Kasurde 532e3ea3ec
test: error handling in include_role (#84737)
Signed-off-by: Abhijeet Kasurde <Akasurde@redhat.com>
9 months ago
Matt Clay 9ef623a517
Integration test cleanup (#84763)
This brings in integration test fixes from the data tagging PR which are unrelated to DT changes.
9 months ago
🇺🇦 Sviatoslav Sydorenko (Святослав Сидоренко) 4a710587dd
🧪 Add macOS 15.3 to CI and `ansible-test` (#84665) 9 months ago
Matt Clay 5ff8d093f0
ansible-test - Code style cleanup (#84749)
* ansible-test - Minor style cleanup (add blank lines)

* ansible-test - Use `"""` instead of `'''`
9 months ago
Jordan Borean e9e6001263
winrm - Remove pexpect kinit code (#84735)
Removes the use of pexpect in the winrm connection plugin and rely on
just subprocess. In the past pexpect was used for macOS compatibility so
that it could handle the TTY prompt but after testing it seems like
subprocess with `start_new_session=True` is enough to get it reading
from stdin on all platforms. This simplifies the code as there's no
longer an optional library changing how things are called and will work
out of the box.
9 months ago
Matt Clay bddb9a7490
ansible-test - Support target testing with black (#84744) 9 months ago
Matt Clay 989e583356
ansible-test - Initial support for black in core (#84741) 9 months ago
Matt Martz 2a3c93f593
Deprecate strategy plugins (#84728)
* Deprecate strategy plugins. Fixes #84725
10 months ago
Jordan Borean a742e20fca
ansible-test validate-modules - fix ps util checks (#84610)
* ansible-test validate-modules - fix ps util checks

Fix the module util import checks done by `ansible-test sanity --test
validate-modules` to support the newer `#AnsibleRequires` import
statement and `-Optional` flag.

* Fix sanity issues
10 months ago
Lee Garrett d21788a9b4
Fix integration tests on debian (#84379)
* Simplify conditional for service_facts integration test

This test requires systemd, so just test for that. Also fixes running this on
Debian testing/unstable releases, where ansible_distribution_version is "n/a".

* Clean up after service_facts integration test

* Simplify set_fact in interpreter_discovery_python test

Those vars are always set, either to something discovered, or "n/a". There are
no evaluations against the value "unknown".

* interpreter_discovery_python: Fix Debian test

Debian doesn't set VERSION_ID in /etc/os-release on pre-releases, see
https://bugs.debian.org/1008735

ansible 2.17 onwards does not support python 2.7 anyway.

* fix deb822_repository integration test failure on Debian

* Fix integration test hostname for Debian

* Fix integration test mount_facts

Some VMs might only have a single mount point, so they only have a single UUID.

* Add package deps for integration test subversion

/usr/bin/htpasswd is shipped in apache2-utils and needed by the main playbook.

* Fix integration test "service" on Debian sid

Debian sid does not set ansible_distribution_version, as such any tests assuming
it's a numeric value will fail. Since this is ancient test code that predates
ansible_service_mgr, remove the error-prone heuristic and rely on that var
instead.

* Fix service integration tests not running on *BSD

---------

Co-authored-by: Lee Garrett <lgarrett@rocketjump.eu>
10 months ago
simonLeary42 55e9e21ded
better error message for malformed documentation (#84705)
No the file name that caused the error will be apparent
---------

Signed-off-by: Abhijeet Kasurde <Akasurde@redhat.com>
Co-authored-by: Abhijeet Kasurde <Akasurde@redhat.com>
10 months ago
Martin Krizek cc30f25c42
Make timeout on become an unreachable error (#84589)
* Make timeout on become an unreachable error

Fixes #84468
10 months ago
Matt Davis 5d7b8288f8
Fix local connection and become issues (#84700)
* Fixed various become-related issues in `local` connection plugin.
* Fixed various issues in `sudo` and `su` become plugins.
* Added unit and integration test coverage.

Co-authored-by: Matt Clay <matt@mystile.com>
Co-authored-by: Matt Davis <nitzmahone@redhat.com>
10 months ago
Martin Wilck 21492e27fa
Add openSUSE MicroOS to SUSE family list (#84685)
* Add openSUSE MicroOS to SUSE family list

Co-authored-by: Abhijeet Kasurde <akasurde@redhat.com>
10 months ago
Abhijeet Kasurde 411b7985a5
test: Enable group tests for Alpine (#84652)
Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
10 months ago
Abhijeet Kasurde d0110ff691
test: enable user test for alpine (#84644)
* test: enable user test for alpine

* Disable user home update tests

* Disable some more tests which are not applicable for Alpine

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
10 months ago
Sloane Hertel d049e7b1b3
fix broken ansible-galaxy-collection resolvelib test (#84626) 10 months ago
Sloane Hertel a086c34a91
linear - don't treat end_role as a run_once task (#84673) 10 months ago
🇺🇦 Sviatoslav Sydorenko (Святослав Сидоренко) cdb1ce000a
Fix `is_pinned` property of `Requirement` (#81812)
Previously, requirement version specs starting with `!=` were
incorrectly considered as pinned release requests because the
comparison was being made against a one-char string while the
operator is two-char. This patch changes the check to test against `!`
which is enough to detect this case.
10 months ago
Sloane Hertel 333ee8d010
Test include_vars reserved variable matching (#84678)
* Add test case for include_vars

* Revise test to catch erroneous warnings
10 months ago
🇺🇦 Sviatoslav Sydorenko (Святослав Сидоренко) ee49adfaf4
🧪🔥 Delete the `egg-info` integration test (#84686)
Previously, the integration test depended on luck. `setuptools` used
to be bundled in Python stdlib's `ensurepip`. Python 3.12 and newer no
longer include it. This test imports `pkg_resources` that is a part of
`setuptools`, meaning that it'll run out of luck at some point, under
newer Python runtimes.

This test does not seem to be useful to us so instead of fixing it, we
remove it from the repo [[1]].

Supersedes #84681.

[1]: https://github.com/ansible/ansible/pull/84681#discussion_r1945525317
10 months ago