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

Installing from artifactory source #101

Open
webframp opened this issue Dec 27, 2017 · 8 comments
Open

Installing from artifactory source #101

webframp opened this issue Dec 27, 2017 · 8 comments

Comments

@webframp
Copy link
Contributor

Just an issue for tracking, not sure how best to debug at this point:

With an artifactory private supermarket source:

$ batali install
[Batali]: Readying installation destination... complete!
[Batali]: Installing cookbooks... error!
[ERROR]: Reason - not in gzip format
ERROR: Zlib::GzipFile::Error: not in gzip format
@chrisroberts
Copy link
Member

Any chance you could send me an asset to have a look at? Looks like I need a license for artifactory to enable the addons.

@webframp
Copy link
Contributor Author

Yea, no problem. I can try to get the raw file and also include details on the chef private supermarket setup. If you can chat on gitter or irc sometime I can provide more details.

I use the Artifactory free trial license for testing stuff like this sometimes.

@webframp
Copy link
Contributor Author

Tested with latest release, here's the traceback:

#<Thread:0x00007fef90026188@/Users/sme/src/chef/infra-repo/vendor/ruby/2.5.0/gems/batali-0.5.0/lib/batali/command/install.rb:25 run> terminated with exception (report_on_exception is true):
Traceback (most recent call last):
        3: from /Users/sme/src/chef/infra-repo/vendor/ruby/2.5.0/gems/batali-0.5.0/lib/batali/command/install.rb:32:in `block (5 levels) in execute!'
        2: from /Users/sme/src/chef/infra-repo/vendor/ruby/2.5.0/gems/batali-0.5.0/lib/batali/source/site.rb:73:in `asset'
        1: from /Users/sme/src/chef/infra-repo/vendor/ruby/2.5.0/gems/batali-0.5.0/lib/batali/source/site.rb:73:in `open'
/Users/sme/src/chef/infra-repo/vendor/ruby/2.5.0/gems/batali-0.5.0/lib/batali/source/site.rb:73:in `initialize': not in gzip format (Zlib::GzipFile::Error)

@webframp
Copy link
Contributor Author

I think the zip warnings may be a red herring. With a little puts'ing around it looks like the path it's attempting to use doesn't exist. For example:

/Users/sme/.batali/cache/site/remote_site/aHR0cHM6Ly9wYWNrYWdlcy5iZXRoZWwuancub3JnOjQ0My9hcnRpZmFjdG9yeS9hcGkvY2hlZi9jaGVmL2FwaS92MS9jb29rYm9va3MvY2hlZi1kay92ZXJzaW9ucy80LjAuMC9kb3dubG9hZA==/asset

@webframp
Copy link
Contributor Author

The issue actually appears to be in how the artifactory api handles downloads. When it reaches here: https://github.com/spox/batali/blob/develop/lib/batali/source/site.rb#L67 to get asset files the response body is empty.

I'm still trying to recreate a test scenario consistently.

@chrisroberts
Copy link
Member

Is it perhaps returning a different redirect (like a 301 or something)?

@webframp
Copy link
Contributor Author

It absolutely is, seems to return 301 for redirects consistently

@webframp
Copy link
Contributor Author

Based off current develop, I added a follow like this:

@@ -62,16 +62,17 @@ module Batali
           retried = false
           begin
             FileUtils.mkdir_p(path)
-            if !url.end_with?("/") && Pathname.new(URI.parse(url).path).extname == ""
-              req_url = "#{url}/"
-            else
-              req_url = url
-            end
-            result = HTTP.get(req_url)
-            while result.code == 302
-              result = HTTP.get(result.headers["Location"])
-            end
-            File.open(a_path = Utility.join_path(path, "asset"), "wb") do |file|
+            req_url = if !url.end_with?('/') && Pathname.new(URI.parse(url).path).extname == ''
+                        "#{url}/"
+                      else
+                        url
+                      end
+            result = HTTP.follow(max_hops: 5).get(req_url)
+            puts "\n#{req_url} -> #{result.code}"
+            # while result.code == 302
+            #   result = HTTP.get(result.headers["Location"])
+            # end
+            File.open(a_path = Utility.join_path(path, 'asset'), 'wb') do |file|

which gets things further, but has another interesting error. Crashes with 3 identical tracebacks all with the following error:

[ERROR]: Reason - "\x80\x00\x00\x00lw\xFD\x1A" is not an octal string

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