mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-06-10 10:19:10 -07:00
Connection error messages are unsafe: wrap them (#37329)
* 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
This commit is contained in:
parent
30bb70cf2d
commit
4378542ac7
6 changed files with 74 additions and 1 deletions
|
@ -170,7 +170,7 @@ class TaskExecutor:
|
|||
display.debug("done dumping result, returning")
|
||||
return res
|
||||
except AnsibleError as e:
|
||||
return dict(failed=True, msg=to_text(e, nonstring='simplerepr'))
|
||||
return dict(failed=True, msg=wrap_var(to_text(e, nonstring='simplerepr')))
|
||||
except Exception as e:
|
||||
return dict(failed=True, msg='Unexpected failure during module execution.', exception=to_text(traceback.format_exc()), stdout='')
|
||||
finally:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue