* Add support for PowerShell modules on POSIX
Adds support for running modules written in PowerShell on non-Windows
hosts. This includes references to a PowerShell or C# module_util
located in Ansible or a collection. Not all module utils will work
outside of Windows but `Ansible.Basic` will do so.
Support for PowerShell modules on non-Windows is up to the module and
collection author. This PR just enables the ability to run them through
the existing PowerShell execution wrapper.
* Fix up sanity and unit tests, try and run in separate CI group
* Fix up powershell.sh group detection
* More sanity fixes
* More sanity fixes
* Ensure shebang is part of command to run
* Try and simplify exec module logic
* Attempt to get powershell group running in CI
* Fix up test integration aliases for powershell
* Remove ansible.windows collection for integration support
* Revert the win_powershell changes now they aren't needed
* Simplify test matrix and use default container
* split the dnf module into a cli shim and a module
* Update package_facts to use rpm cli, add package_facts and rpm_key to rhel8 targeted testing
* Switch resource embedding to EmbedManager.embed API
Co-authored-by: Matt Davis <nitzmahone@redhat.com>
* Add new psrp options and change service default
Add new options to the `psrp` connection plugin to specify the profile
loading behaviour and a password to use for decrypting the certificate
authentication private key.
This also changes the `negotiate_service` default from `WSMAN` to `host`
to improve compatibility with Windows targets that may not have the
`WSMAN` SPN registered like domain controllers and align with the
defaults the native PowerShell PSRemoting client uses.
* Update lib/ansible/plugins/connection/psrp.py
Co-authored-by: Abhijeet Kasurde <akasurde@redhat.com>
---------
Co-authored-by: Abhijeet Kasurde <akasurde@redhat.com>
* ansible-galaxy - only install/download collections with compatible requires_ansible metadata
inject requires_ansible as a dependency of the collection
add a hack to preserve the collection origin in the error message in get_dependencies and find_matches
* yield requires_ansible requirement before dependencies
* Fix error handling and broken test
Fix getting requires_ansible dependency after the metadata is available
Allow 3rd party servers to provide this metadata lazily for individual versions
Rename the candidate attr name for the error handling hack
* fix diff
* clarify code comments
refactor a bit
* Don't duplicate error message. Before:
[ERROR]: Failed to resolve the requested dependencies map. Could not satisfy the following requirements:
* ns.col2:1.0.0 (dependency of ns.col3:1.0.0) requires ansible-core <2.19.1
Hint: To disregard whether the collection supports the current version of ansible-core, configure COLLECTIONS_ON_ANSIBLE_VERSION_MISMATCH as "ignore".
Hint: Pre-releases hosted on Galaxy or Automation Hub are not installed by default unless a specific version is requested. To enable pre-releases globally, use --pre: [RequirementInformation(requirement=<ansible-core:<2.19.1 of type 'requires_ansible' from Galaxy>, parent=<ns.col2:1.0.0 of type 'galaxy' from cmd_arg>)]
Failed to resolve the requested dependencies map. Could not satisfy the following requirements:
* ns.col2:1.0.0 (dependency of ns.col3:1.0.0) requires ansible-core <2.19.1
Hint: To disregard whether the collection supports the current version of ansible-core, configure COLLECTIONS_ON_ANSIBLE_VERSION_MISMATCH as "ignore".
Hint: Pre-releases hosted on Galaxy or Automation Hub are not installed by default unless a specific version is requested. To enable pre-releases globally, use --pre.
<<< caused by >>>
[RequirementInformation(requirement=<ansible-core:<2.19.1 of type 'requires_ansible' from Galaxy>, parent=<ns.col2:1.0.0 of type 'galaxy' from cmd_arg>)]
After:
[ERROR]: Failed to resolve the requested dependencies map. Could not satisfy the following requirements:
* ns.col2:1.0.0 (dependency of ns.col3:1.0.0) requires ansible-core <2.19.1
Hint: To disregard whether the collection supports the current version of ansible-core, configure COLLECTIONS_ON_ANSIBLE_VERSION_MISMATCH as "ignore".
Hint: Pre-releases hosted on Galaxy or Automation Hub are not installed by default unless a specific version is requested. To enable pre-releases globally, use --pre.
* appease CI
fix type hints
* Update changelogs/fragments/install-ansible-core-compatible-collections.yml
Co-authored-by: sivel / Matt Martz <matt@sivel.net>
* Hardcode unsupported requires_ansible version to make maintaining the tests easier
Add a test for failed backtracking
Co-authored-by: sivel / Matt Martz <matt@sivel.net>
---------
Co-authored-by: sivel / Matt Martz <matt@sivel.net>
* Fix vaulted value rendering
- Fixes AnsibleDumper works on vaulted strings
- Adds config setting for opting in to future forced-strictness
* Add tests for new to_yaml functionality
* Add return on all paths
* Clarify configured value name
* Fix sanity (remove unused import)
* Catch more cases of encrypted strings
* WIP fix failing unit tests
* Update unit test to work with new to_yaml features
* Remove unit test
Running coverage with/without shows no new coverage.
* Write some basic error text
* Fix tests for error configuration
* Change names
- Change `vault_behavior` to just `vault`
- Change `preserve` to `keep_encrypt`
* Fix small issues in tests
* Fix fmt with black
* Fix unit tests
- Fix imports
- Fix the name of the param
* Update assorted docs - code review
Co-authored-by: Abhijeet Kasurde <akasurde@redhat.com>
* Remove deprecation
* Simplify vault parameter and handling
- Get rid of `default` enum
- Get rid of config option and associated test file
- Change `vault` to `vault_behavior`
* Document filter parameter
* Correctly Document filter parameter
* Add version_added and changelog fragment
* Tweak changelog
* Remove dead code, add docstring
* Add bugfixes section to changelog
Co-authored-by: Matt Davis <6775756+nitzmahone@users.noreply.github.com>
---------
Co-authored-by: Abhijeet Kasurde <akasurde@redhat.com>
Co-authored-by: Matt Davis <6775756+nitzmahone@users.noreply.github.com>
* Add PowerShell 7 support
Add support for running PowerShell modules cross platform and with
PowerShell 7. Tidies up some PowerShell shell plugin methods to make
it more reflective of the target shell vs a shell used for Windows.
Currently only Windows is officially supported with a plan on adding
tests and official support for non-Windows platforms at a later date.
ci_complete
* Fix pslint sanity issues
* Fix up typos
* Update lib/ansible/plugins/connection/psrp.py
Co-authored-by: Brian Scholer <1260690+briantist@users.noreply.github.com>
* Add note about relative symlink
* Use TracebacksFor instead of Verbosity for debug info
* Use proper powershell name in CI script
* Remove extra ansible-test changes leftover from rebase
---------
Co-authored-by: Brian Scholer <1260690+briantist@users.noreply.github.com>
Fix network module failures on tagged RPC responses
* Zap tags in networking JsonRpcServer before pickling responses.
* Verify with unit test - suboptimal, but avoids a fake network connection plugin.
The local connection plugin is incorrectly passing a bytearray to methods of become plugins that expect bytes. A recent change to the su plugin exposed this by breaking the become plugin for different locale settings (the bytearray was not properly converted to a str for comparison operations). This changes the local connection plugin to send bytes.
* ansible-galaxy - Change error to warning when no paths exist
When listing collections, a warning is much more appropriate than an error
for missing paths.
* winrm - Add better Kerberos error
Adds a better error when Kerberos authentication is requested but the
`pykerberos` library is not installed. This also removes the fallback to
basic auth if the username is in the UPN format and no transport/auth
method is specified. This is because a UPN user must be a domain account
and domain accounts cannot be used with basic auth.
* Add more docs about user settings
* Fix some grammar issues
* GNU digest line may contain multiple spaces between
checksum and filename. Fix regex to handle this situation.
Fixes: #86132
Signed-off-by: Abhijeet Kasurde <Akasurde@redhat.com>
* Report bad-return-value-key for return values that cannot be accessed with Jinja's dot notation.
* Move constants into separate module.
* Add test to check FORBIDDEN_DICTIONARY_KEYS against current Python's key list.
* Remove unused constant.
* Apply suggestions from code review.
Co-authored-by: Matt Clay <matt@mystile.com>
* Add type annotations.
* Simplify typing.
Co-authored-by: Matt Clay <matt@mystile.com>
---------
Co-authored-by: Matt Clay <matt@mystile.com>
* Handle ValueError raised when user set invalid priority values
* Update tests to work with Pytest
Signed-off-by: Abhijeet Kasurde <Akasurde@redhat.com>
Co-authored-by: Mannu Silva <wise.tent4987@fastmail.com>
* Remove safe_eval from codebase
Resolves deprecations in 85996 and 85999
* Remove deprecations from sanity ignores
* Add changelog fragment
* Add newline to file
* Remove unused imports
* Add support for crypt/libxcrypt via ctypes, as an alternative to passlib
* move verbosity message to BaseHash
* Don't require DYLD_LIBRARY_PATH mods for standard homebrew installs on macos
* improve crypt_gensalt error handling
* ansible-galaxy - remove deprecated v2 API
Update unit tests exercising the v2 Galaxy API
Remove v2 API integration tests
* Remove internal test configuration for servers which support API v2 and v3
* Update and simplify verify tests by using the configured server list
* templating coerces None to empty string on multi-node result
* avoid simple cases of embedded `None` in multi-node string concatenated template results ala <=2.18
* single-node template results preserve NoneType
* add None->empty str equivalency to argspec validation
* fix integration tests
* remove conversion error message check from apt_repository test
* remove error message check on `None` value for required str argspec in roles_arg_spec test (now logically-equivalent to empty string)
* explanatory comment for None->empty str coalesce