mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
4378542ac7
* 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
19 lines
544 B
YAML
19 lines
544 B
YAML
- hosts: testhost
|
|
gather_facts: false
|
|
tasks:
|
|
- name: "use a connection plugin raising an exception, exception message contains Jinja template."
|
|
connection: dummy
|
|
command: /bin/true # command won't be executed
|
|
register: result
|
|
ignore_errors: True
|
|
|
|
- name: "check that Jinja template embedded in exception message isn't rendered"
|
|
debug:
|
|
msg: 'ok'
|
|
when: result is failed
|
|
register: debug_task
|
|
|
|
- assert:
|
|
that:
|
|
- result is failed
|
|
- debug_task is success
|