* Check that connection error msg are not unsafe
* Connection error messages are unsafe: wrap them
For example, in case of error, docker connection plugin returns exception
message containing Go template. These messages weren't tagged as unsafe
and were consequently rendered:
The conditional check 'result is failed' failed. The error was:
{
'msg': u'Docker version check ([\'/usr/bin/docker\', \'version\', \'--format\', "\'{{.Server.Version}}\'"]) failed: Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get http://%2Fvar%2Frun%2Fdocker.sock/v1.35/version: dial unix /var/run/docker.sock: connect: permission denied\n',
'failed': True
}:
template error while templating string: unexpected '.'.
String: Docker version check (['/usr/bin/docker', 'version', '--format', "'{{.Server.Version}}'"]) failed: Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get http://%2Fvar%2Frun%2Fdocker.sock/v1.35/version: dial unix /var/run/docker.sock: connect: permission denied
(cherry picked from commit 4378542ac7)
Otherwise, it fail with:
Traceback (most recent call last):
File \"/tmp/ansible_c1zmq3i9/ansible_module_openssl_certificate.py\", line 808, in <module>
main()
File \"/tmp/ansible_c1zmq3i9/ansible_module_openssl_certificate.py\", line 787, in main
certificate.generate(module)
File \"/tmp/ansible_c1zmq3i9/ansible_module_openssl_certificate.py\", line 692, in generate
certfile.write(str(crt))
TypeError: a bytes-like object is required, not 'str'
(cherry picked from commit 347b5d1e50)
* PY3 = dnf
Red Hat are unlikely to provide a Python 2 version of the yum bindings
as they are moving to `dnf`.
If Ansible can't find the yum Python library give the user a hint about
dnf and Python 3
(cherry picked from commit 6c8d40f653)
* Fix unarchive with strip-components in extra_opts
When unarchive is given extra_opts to strip all leading directories, it
could end up trying to change the permissions on the root directory.
Tar archives shouldn't contain absolute paths anyways so make sure that
all paths are relative as we handle them.
Fixes#21397
(cherry picked from commit cca0ccaf97)
* Fix credentials for Tower API V2
(cherry picked from commit 640749d54f)
* tower cred: implement credential /api/v1/ kind compatability
(cherry picked from commit 9cb4b70e27)
* tower cred: filter user name lookup by the proper key
(cherry picked from commit cd6855275e)
* tower cred: update kind options in documentation
(cherry picked from commit 8a41233202)
* tower cred: support credential kind/type for /api/v1/ and /api/v2/ (#36662)
older versions of Tower (3.1) don't have a concept of CredentialTypes
(this was introduced in Tower 3.2). This change detects older versions
of pre-3.2 tower-cli that *only* support the deprecated `kind`
attribute.
(cherry picked from commit 641f8b4ef6)
* Add CHANGELOG entry for Ansible Tower module credential fix
* properly detect the absence of credential_type in older tower-cli (#36908)
(cherry picked from commit a82043939b)
* Do not import HAS_TOWER_CLI since it does not exist in stable-2.4
* properly pass /api/v1/ credential fields for older Towers (#36917)
(cherry picked from commit 0e7106b106)
* fix loop_control templating
- properly template ALL properites for loop_control
- loop_control inherits from base, it should not, but needs validate/attribute functionality
fixes#24719
(cherry picked from commit 8de4f7cd9f)
* Start of tests for modify_module, specifically to ensure proper shebang replacement on old style modules (#36602)
(cherry picked from commit a7062b7587)
* Modify test to work on 2.4 due to lacking templar kwarg
* Bug in del(list) logic. Say you have a list of 4 elements a[0-3]
and you have to remove index 1 and 3, if you remove index 1 first
then list is cut short a[0-2] and does not have index 3
Fix: Remove indexes in reverse sorted order e.g. 3 and 1 in above
example so that order of indexes remain preserved even after deleting
fix is to remove indexes in reverse sorted order
* Add test cases for failed case
(cherry picked from commit 0bbea9a579)
* Fix types when evaluating interpreter. Fixes#36536
* Rename variables that contain bytes to b_*
* Get rid of to_text() and to_bytes() calls that do nothing (because the
data is already the proper type)
(cherry picked from commit a4df4d33ac)
* Add example on how to use a here document with shell module
* Remove here doc example and add note to use script module instead
(cherry picked from commit 5e7ee9df0a)
* Re-use logic from StrategyBase._load_included_file in StrategyModule.run for free and linear (#36470)
This improves include_role performance and recursion limits
(cherry picked from commit 10fefc7156)
* Add changelog for 36470
This fixes implementation of extra config for virtual machine.
Fixes: #32004
Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
(cherry picked from commit 80fb836ce5)