Skip to content
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

wget creates empty file #25

Closed
makeacode opened this issue Jan 28, 2017 · 3 comments
Closed

wget creates empty file #25

makeacode opened this issue Jan 28, 2017 · 3 comments

Comments

@makeacode
Copy link
Contributor

after doing some googling it seems that wget will create an empty file even if there was a problem accessing the specified url. i've had this happen a few times and the module does not fix it since it only checks for the presence of the desired file.

Possible solutions are:

wget "url" -O file || rm -f file

  • or -

curl -f http://nonexistent/file.jpg -o localfile.jpg

I don't know which is preferred so if you have an opinion on one over the other I'll submit a pull request with the changes.

@pcfens
Copy link
Contributor

pcfens commented Jan 28, 2017

I'm not able to get wget to make that happen when I go to URLs that return a 404 or hosts that don't exist at all. Maybe it's a distribution/version thing?

Rather than using an exec resource, what if I changed it from wget to use lwf/remote_file instead?

@makeacode
Copy link
Contributor Author

Hmm...I tried on Scientific Linux 6.8 at work and Ubuntu 14 vagrant box and both do it.

Try this and you should end up with 0 byte file called test:

wget -O 'test' 'http://www.google1.com'

@pcfens pcfens closed this as completed in ed7a0f5 Jan 29, 2017
@pcfens
Copy link
Contributor

pcfens commented Jan 29, 2017

I was doing something wrong and completely different when I tested this and couldn't re-create the issue.

I'll try and get a new release rolled up tomorrow early afternoon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants