kindredgroup / puppet-forge-server

Private Puppet forge server supports local files and both v1 and v3 API proxies
69 stars 44 forks source link

Can't cache a module beginning with a number #60

Closed bsauvajon closed 6 years ago

bsauvajon commented 7 years ago

When I try to download the module 3fs-phantomjs it ends with a 404 error In puppet-forge-server logs, I can see that the download form official puppet forge is ok, but then it can't retrieve the module from the cache.

DEBUG  Fetching data for url: https://forgeapi.puppetlabs.com/v3/files/3fs-phantomjs-0.0.8.tar.gz from remote server
DEBUG  Data for url: https://forgeapi.puppetlabs.com/v3/files/3fs-phantomjs-0.0.8.tar.gz fetched, 2418 bytes
ERROR  PuppetForgeServer::Backends::ProxyV3 failed downloading file '3fs-phantomjs-0.0.8.tar.gz'
ERROR  Error: No such file or directory - /srv/puppet-forge-server/cache/93c654b7b5d3bff7decd0a021bf7cd0a28040c3c/3/3fs-phantomjs-0.0.8.tar.gz
"GET /v3/files/3fs-phantomjs-0.0.8.tar.gz HTTP/1.1" 404 28 0.7435

Looking in the cache directory, I see subdirectories called a to z, but note 0 to 9. I created these directories and now it works fine. Could you create these directories during cache initialization ?

i11 commented 7 years ago

Hi,

Thanks for reporting it! It's actually quite easy to add, this line: https://github.com/unibet/puppet-forge-server/blob/master/lib/puppet_forge_server/backends/proxy.rb#L31 should change like that

- (10...36).each do |i|
+ (0...36).each do |i|

I'll do some changes next week. Otherwise feel free to submit a PR if you're in the hurry.

Thanks!