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

chef 13 issue with cookbooks and knife #51

Open
rmoriz opened this issue Jul 12, 2017 · 3 comments
Open

chef 13 issue with cookbooks and knife #51

rmoriz opened this issue Jul 12, 2017 · 3 comments

Comments

@rmoriz
Copy link

rmoriz commented Jul 12, 2017

Hi,

I'm using goiardi 0.11.5 and knife backup to backup/restore all data from/to git into/out of goiardi.

However when using the latest chefdk (2.0.26) that comes with chef 13 (13.2.20), I cannot download cookbooks anymore:

➜   knife backup export -V        
…
Backing up environments
Backing up cookbooks
Backing up cookbook acme
Downloading acme cookbook version 3.1.0
Failed to download cookbook acme version 3.1.0... Skipping
ERROR: Errno::ENOENT: No such file or directory @ unlink_internal - .chef/chef_server_backup/cookbooks/acme-3.1.0

Core knife functionality is broken, too:

➜  knife cookbook download acme 3.1.0
Downloading acme cookbook version 3.1.0
ERROR: TypeError: no implicit conversion of String into Integer

(acme is just the first cookbook in alphabetic order on my goiardi instance)

UPDATE

Okay, started to debugging with pry:

=> 3.1.0
[5] pry(#<Chef::Knife::CookbookDownload>)>     cookbook = Chef::CookbookVersion.load(@cookbook_name, @version)
TypeError: no implicit conversion of String into Integer
from /tmp/chef/lib/chef/server_api_versions.rb:33:in `[]'

UPDATE 2

Downloading acme cookbook version 3.1.0

From: /tmp/chef/lib/chef/server_api_versions.rb @ line 30 Chef::ServerAPIVersions#min_server_version:

    29: def min_server_version
 => 30:   binding.pry
    31: 
    32:   # If we're working with a pre-api-versioning server, always claim to be zero
    33:   if @versions.nil?
    34:     unversioned? ? 0 : nil
    35:   else
    36:     Integer(@versions["min_version"])
    37:   end
    38: end

[1] pry(#<Chef::ServerAPIVersions>)> @versions
=> 0
[2] pry(#<Chef::ServerAPIVersions>)> Integer(@versions["min_version"])
TypeError: no implicit conversion of String into Integer
from (pry):4:in `[]'

Bingo…

@rmoriz
Copy link
Author

rmoriz commented Jul 12, 2017

Either "0" was never implemented by vanilla chef-server or this is a recent bug of chef… what do you think?

The source of @versions is http/api_versions.rb

example header:

[20] pry(#<Chef::HTTP::APIVersions>)> http_response.each_header {|key,value| puts "#{key} = #{value}" }
server = openresty/1.11.2.3
date = Wed, 12 Jul 2017 01:46:14 GMT
content-type = application/json
content-length = 142
connection = close
x-chef-version = 11.1.7
x-goiardi = yes
x-goiardi-version = 0.11.5
x-ops-api-info = flavor=osc;version:11.1.7;goiardi=0.11.5
x-ops-server-api-version = 0
strict-transport-security = max-age=63072000; includeSubDomains; preload
x-frame-options = DENY
x-content-type-options = nosniff
=> {"server"=>["openresty/1.11.2.3"],
 "date"=>["Wed, 12 Jul 2017 01:46:14 GMT"],
 "content-type"=>["application/json"],
 "content-length"=>["142"],
 "connection"=>["close"],
 "x-chef-version"=>["11.1.7"],
 "x-goiardi"=>["yes"],
 "x-goiardi-version"=>["0.11.5"],
 "x-ops-api-info"=>["flavor=osc;version:11.1.7;goiardi=0.11.5"],
 "x-ops-server-api-version"=>["0"],
 "strict-transport-security"=>["max-age=63072000; includeSubDomains; preload"],
 "x-frame-options"=>["DENY"],
 "x-content-type-options"=>["nosniff"]}

@ctdk
Copy link
Owner

ctdk commented Jul 12, 2017

Well then, I guess I shouldn't have added that API version header, eh? It seemed like it would be a "not essential, but good to have" thing to have around, but since it was always kind of decorative it should get yanked out until such time as I finally finish 12+ compat. (I swear, I still plan on doing so, but there's been a combination of other things coming up, not feeling at my best more lately, and somehow having found myself not actually strongly needing organizations, but it's actually fairly close.) I'll test this out and should have a fix turned around shortly.

@ctdk
Copy link
Owner

ctdk commented Jul 14, 2017

So I yanked that header (which it turns out I had totally misunderstood how it worked - oops) and pushed that up to master. Unfortunately knife cookbook download at least is still breaking for a different reason - it expects a cookbook to be returned with :all_files in the manifest, which goiardi doesn't do yet (because it's still just chef 11 with the occasional chef 12 aspect).

I'm mulling over what the best way forward is, but I think I need to get in gear on finally completing the chef 12+ work I've been putting off all this time.

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