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
get_url
gives confusing error message when destination already exists
#44857
Comments
Files identified in the description: If these files are inaccurate, please update the |
I cannot duplicate this issue. The only thing that I can assume, is that the result of Can you run the following for me?
As of right now, this produces the following for me:
needs_info |
@sivel Thanks for the reply. Probably adding the touch was misleading, I can reproduce the issue by running the command twice in a row. The result of your command after touching for me is:
|
A very random guess, but I though I'd mention it, since last time I reported an issue to a python repo, I was the only one getting it, and it was due to this issue. Sometimes the standard |
Yes, ansible utilizes urllib2 under the hood for making requests. FWIW, I tested with both touch and running the command 2 times. I cannot think of why you would get a 400 Bad Request, based on that info provided above. It's not expected, and for whatever reason, something that is being sent in the request is causing the remote server to respond that way. The only thing I can imagine is the I don't know of an easy way to debug this, other than using some what to intercept the request and response using something like mitmproxy. If you are able to install mitmproxy (python library), and run it (
That gives me something like the following: Request:
Response:
The status code isn't listed there, but I got a |
Nice, thanks! Yeah, I was terribly confused by this "Bad request" error. I'll try to log the request & response using the way you mentioned. The information you show is "compatible" with the issue with Anyways, I'll run the steps you mentioned and report my results here. 👍 |
@sivel You nailed it! Nothing related to my suspicions, but totally related to yours! It's a bad character in the Request
Response Headers
Response body<?xml version='1.0' encoding='UTF-8'?>
<Error>
<Code>InvalidArgument</Code>
<Message>Invalid argument.</Message>
<Details>If-Modified-Since:mié, 29 ago 2018 19:16:15 +0000</Details>
</Error> |
It sounds like |
LANG=C ansible localhost -m get_url -a 'url=https://shellcheck.storage.googleapis.com/shellcheck-v0.5.0.linux.x86_64.tar.xz dest=/tmp/shellcheck-v0.5.0.linux.x86_64.tar.xz' works just fine. |
I believe you are correct, but I'm not sure we can rely on the strftime functionality in python at that point. We may need to handle it ourselves. I'll have to do more research here. |
Well, thanks so much for your support, it was really helpful! |
I have a pull request that should resolve this issue: #44868 |
I confirm that the PR fixes my issue, thanks a lot! ❤️ |
Great! I'm re-evaluating a few assumptions, just to see if I can not duplicate the formatting code. Once I've completed that and tests are passing, I'll get that PR merged. |
* Introduce and use locale-naive rfc2822 date format function. Fixes #44857 * Adjust test expected response
SUMMARY
The current
get_url
docs for theforce
anddest
parameter does not make it clear what the expected behavior is whendest
exists andforce
isfalse
(the default). I kind of expect that it just succeeds. In any case, I think the error message one currently gets is very confusing.ISSUE TYPE
COMPONENT NAME
get_url
ANSIBLE VERSION
CONFIGURATION
OS / ENVIRONMENT
N/A
STEPS TO REPRODUCE
EXPECTED RESULTS
I think... success. If not, a more helpful error message, like "destination already exists. Use `force: true` to force redownload, or specify a checksum to prevent it".
ACTUAL RESULTS
The text was updated successfully, but these errors were encountered: