-
Notifications
You must be signed in to change notification settings - Fork 23.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to pass in the "dest:" parameter into the "win_uri" module (unlike the "uri" module) #19575
Comments
That certainly seems like something it should do! I'm surprised by my oversight. I'll try to put together a PR before I go AWOL for the holidays, but if I don't, I have some time off next week and will try to see about adding it. |
Thank you very much, Corwin! |
Also, this is a minor thing, but is there any way that the source code of win_uri.ps1 and win_uri.py can be made public like the other Windows modules, on this page? https://github.com/ansible/ansible-modules-core/tree/devel/windows It's not critical or anything, but I was just curious to see that this module wasn't listed there. |
It's not listed for 2 reasons:
|
Ah OK, thanks for the clarification! |
When you get a chance, check out #19577 and see if that works for you. |
Thank you so much! We will test this out ASAP! |
Hi Corwin, Thank you again for working on this promptly. I sincerely appreciate it. I just tested out this enhancement, but unfortunately, I get the following result: An exception occurred during task execution. The full traceback is: + Set-Attr $result.dest "dest" $dest + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ My playbook is exactly as described before. It appears that there may be an issue with the new code checked in; alternatively, if there is anything I need to do on my end, please let me know. Let me know what you think. All the best, Michael |
Yup, that's totally right, that will bomb out. Sorry about that, try it again now |
It works! Thank you so much, Corwin! |
#19577 has been merged. Closing this as fixed. |
ISSUE TYPE
COMPONENT NAME
win_uri module
ANSIBLE VERSION
ansible 2.1.0.0
CONFIGURATION
OS / ENVIRONMENT
N/A
SUMMARY
The "win_uri" module is, in theory, the Windows equivalent of the standard "uri" module (which is normally run on a Linux node). However, in practice, there are certain limitations that the "win_uri" module has versus the "uri" module. For me, the most striking difference is the lack of a "dest" parameter. This is something that we need, as we may use the "win_uri" module to download files from a URL, and we will need the option to store this file at some configurable destination on the server. While the "win_get_url" module DOES allow for a "dest" parameter, it is also limited by not having a "headers" parameter (which I have logged as the separate issue 19573: #19573)
STEPS TO REPRODUCE
Compare the acceptable options here:
http://docs.ansible.com/ansible/uri_module.html
versus here:
http://docs.ansible.com/ansible/win_uri_module.html
win_uri:
url: <URL_TO_FILE_TO_DOWNLOAD>
headers:
<API_TOKEN>: <API_TOKEN_VALUE>
dest: D:\temp\
EXPECTED RESULTS
The file is downloaded in the specified directory. No errors are returned.
ACTUAL RESULTS
There's no error at all, for that matter, and the output makes it appear that the module worked properly. However, no file is downloaded to the specified directory.
ok: [<server_name>] => {"base_response": {"CharacterSet": "UTF-8", "ContentEncoding": "", "ContentLength": 22, "ContentType": "text/plain; charset=UTF-8", "Cookies": [{"Comment": "", "CommentUri": null, "Discard": false, "Domain": "<SERVER_NAME>", "Expired": false, "Expires": "/Date(-62135578800000)/", "HttpOnly": false, "Name": "ROUTEID", "Path": "//", "Port": "", "Secure": false, "TimeStamp": "/Date(1482257645188)/", "Value": ".", "Version": 0}], "Headers": ["X--Id", "X--Node-Id", "X-Checksum-Sha1", "X-Checksum-Md5", "X--Filename", "Content-Disposition", "Connection",
"Accept-Ranges", "Content-Length", "Content-Type", "Date", "ETag", "Last-Modified", "Set-Cookie", "Server"], "IsFromCache": false, "IsMutuallyAuthenticated": false, "LastModified": "/Date(1456626053000)/", "Method": "GET", "ProtocolVersion": {"Build": -1, "Major": 1, "MajorRevision": -1, "Minor": 1, "MinorRevision": -1, "Revision": -1}, "ResponseUri": "<path_to_file>/sample.txt", "Server": "/4.5.1", "StatusCode": 200, "StatusDescription": "OK", "SupportsHeaders": true}, "changed": false, "content": "This is a sample file\n", "headers": {"Accept-Ranges": "bytes", "Connection": "close", "Content-Disposition": "attachment; filename="sample.txt"; filename*=UTF-8''sample.txt", "Content-Length": "22", "Content-Type": "text/plain; charset=UTF-8", "Date": "Tue, 20 Dec 2016 18:14:05 GMT", "ETag": "aad47f5e6428ad31fcadccde1ae203ddc1b45351", "Last-Modified": "Sun, 28 Feb 2016 02:20:53 GMT", "Server": "/4.5.1", "Set-Cookie": "ROUTEID=.; path=//", "X--Filename": "sample.txt", "X--Id": "", "X--Node-Id": "<NODE_ID>", "X-Checksum-Md5": "c80b7d4d21295e061698eb4dac1522df", "X-Checksum-Sha1": "aad47f5e6428ad31fcadccde1ae203ddc1b45351"}, "images": [], "input_fields": [], "invocation": {"module_name": "win_uri"}, "links": [], "raw_content": "HTTP/1.1 200 OK\r\nX--Id: \r\nX--Node-Id: <NODE_ID>2\r\nX-Checksum-Sha1: aad47f5e6428ad31fcadccde1ae203ddc1b45351\r\nX-Checksum-Md5: c80b7d4d21295e061698eb4dac1522df\r\nX--Filename: sample.txt\r\nContent-Disposition: attachment; filename="sample.txt"; filename*=UTF-8''sample.txt\r\nConnection: close\r\nAccept-Ranges: bytes\r\nContent-Length: 22\r\nContent-Type: text/plain; charset=UTF-8\r\nDate: Tue, 20 Dec 2016 18:14:05 GMT\r\nETag: aad47f5e6428ad31fcadccde1ae203ddc1b45351\r\nLast-Modified: Sun, 28 Feb 2016 02:20:53 GMT\r\nSet-Cookie: ROUTEID=.<ROUTE_ID>; path=//\r\nServer: /4.5.1\r\n\r\nThis is a sample file\n", "raw_content_length": 22, "raw_content_stream": {"CanRead": true, "CanSeek": true, "CanTimeout": false, "CanWrite": true, "Capacity": 22, "Length": 22, "Position": 22, "ReadTimeout": null, "WriteTimeout": null}, "status_code": 200, "status_description": "OK", "win_uri": {"content_type": null, "method": "GET", "url": <SERVER_NAME>/sample.txt", "use_basic_parsing": true}}
The text was updated successfully, but these errors were encountered: