Fix Ansible 2.7 uri module

The 'path' argument doesn't exist, but 'src' and 'dest' do.

Currently this fails due to a KeyError if the module is used.

Also, fix the test case to use the 'dest' attribute which is
what all versions of the module actually use, rather than
'path'.

Change-Id: I09ec78ec16beb455338cf311fc4a9d23442071ab
This commit is contained in:
James E. Blair 2019-03-20 15:44:59 -07:00
parent 01a8eb80f0
commit aff5bdd8b1
2 changed files with 5 additions and 2 deletions

View File

@ -3,4 +3,4 @@
- uri:
method: GET
url: https://example.com
path: /tmp/example.out
dest: /tmp/example.out

View File

@ -30,6 +30,9 @@ class ActionModule(uri.ActionModule):
return paths._fail_module_dict(self._task.action)
if paths._is_localhost_task(self):
paths._fail_if_unsafe(self._task.args['path'])
for arg in ('src', 'dest'):
dest = self._task.args.get(arg)
if dest:
paths._fail_if_unsafe(dest)
return super(ActionModule, self).run(tmp, task_vars)