Closed lamont-granquist closed 10 years ago
@lamont-granquist thanks for the bug report - I'm away for the next week but will be starting work on the next release when I return - I'll dig into this then & have added this to that milestone. Spork support passing paths in a variety of places, and it seems like one of them (or more specifically, how I coded that behaviour) is breaking this.
Yeah, I haven't had time to look at it either. I just rolled back to old config since I didn't have time to stop and fix. Berkshelf had an issue as well, jamie only just pushed a fix a couple days go. Generally now all the directory config stuff can be an array or a string, and all the derived cases can be driven off of the single chef_repo_path
@lamont-granquist just digging into this now - what version of chef-client did you have installed when you saw this? Could I also please have the -VV output of the command which produced this error?
Probably 12.0.0.alpha.1...
Well this is odd, there's no stack dump with -VV:
% knife spork bump sk_role_base -VV
FATAL: No default cookbook_path; Specify with -o or fix your knife.rb.
USAGE: knife spork bump COOKBOOK [major|minor|patch|manual]
-s, --server-url URL Chef Server URL
--chef-zero-host HOST Host to start chef-zero on
--chef-zero-port PORT Port (or port range) to start chef-zero on. Port ranges like 1000,1010 or 8889-9999 will try all given ports until one works.
-k, --key KEY API Client Key
--[no-]color Use colored output, defaults to false on Windows, true otherwise
-c, --config CONFIG The configuration file to use
-o, --cookbook-path PATH:PATH A colon-separated path to look for cookbooks in
--defaults Accept default values for all questions
-d, --disable-editing Do not open EDITOR, just accept the data as is
-e, --editor EDITOR Set the editor to use for interactive commands
-E, --environment ENVIRONMENT Set the Chef environment (except for in searches, where this will be flagrantly ignored)
-F, --format FORMAT Which format to use for output
-z, --local-mode Point knife commands at local repository instead of server
-u, --user USER API Client Username
--print-after Show the data after a destructive operation
-V, --verbose More verbose output. Use twice for max verbosity
-v, --version Show chef version
-y, --yes Say yes to all prompts for confirmation
-h, --help Show this message
@lamont-granquist hmm - that is odd. Can you verify that this only happens with 12.x and not the latest stable 11.x release? Just to narrow down where I go digging :p
Well, it was probably off master, but I replicated with 11.14.2.
-VV isn't giving me a stacktrace, but its coming from:
And github loses posts when i back up...
Awsome, thanks for the info - I'll take a look! Hoping to get this out in the next release, this week most likely.
weird.
pp config[:cookbook_path] results in "/Users/lamont/env/sk/chef-repo/cookbooks", but config.has_key?(:cookbook_path)
is false.
it looks like mixlib-shellout is not setting has_key? to true when the config value is set to a default value or something?
This is gonna be one of them fun ones, I can just tell :p
Well I think you can change it to test for .nil? or something like that and work around mixlib-shellout's behavior...
That sounds like a plan - gonna poke at this tomorrow and will try that first.
So the next problem after that is that it can be a string instead of an array:
% knife spork bump sk_role_base -VV
"/Users/lamont/env/sk/chef-repo/cookbooks"
/Users/lamont/.rvm/gems/ruby-2.1.2/gems/knife-spork-1.3.4/lib/knife-spork/runner.rb:138:in `environment_path': undefined method `first' for "/Users/lamont/env/sk/chef-repo/environments":String (NoMethodError)
from /Users/lamont/.rvm/gems/ruby-2.1.2/gems/knife-spork-1.3.4/lib/knife-spork/runner.rb:46:in `run_plugins'
from /Users/lamont/.rvm/gems/ruby-2.1.2/gems/knife-spork-1.3.4/lib/chef/knife/spork-bump.rb:48:in `run'
from /Users/lamont/.rvm/gems/ruby-2.1.2/gems/chef-12.0.0.alpha.0/lib/chef/knife.rb:493:in `block in run_with_pretty_exceptions'
from /Users/lamont/.rvm/gems/ruby-2.1.2/gems/chef-12.0.0.alpha.0/lib/chef/local_mode.rb:38:in `with_server_connectivity'
from /Users/lamont/.rvm/gems/ruby-2.1.2/gems/chef-12.0.0.alpha.0/lib/chef/knife.rb:492:in `run_with_pretty_exceptions'
from /Users/lamont/.rvm/gems/ruby-2.1.2/gems/chef-12.0.0.alpha.0/lib/chef/knife.rb:175:in `run'
from /Users/lamont/.rvm/gems/ruby-2.1.2/gems/chef-12.0.0.alpha.0/lib/chef/application/knife.rb:139:in `run'
from /Users/lamont/.rvm/gems/ruby-2.1.2/gems/chef-12.0.0.alpha.0/bin/knife:25:in `<top (required)>'
from /Users/lamont/.rvm/gems/ruby-2.1.2/bin/knife:23:in `load'
from /Users/lamont/.rvm/gems/ruby-2.1.2/bin/knife:23:in `<main>'
from /Users/lamont/.rvm/gems/ruby-2.1.2/bin/ruby_executable_hooks:15:in `eval'
from /Users/lamont/.rvm/gems/ruby-2.1.2/bin/ruby_executable_hooks:15:in `<main>'
And then if I make that an array it also wants environment_path to be an Array:
% knife spork bump sk_role_base -VV
["/Users/lamont/env/sk/chef-repo/cookbooks"]
/Users/lamont/.rvm/gems/ruby-2.1.2/gems/knife-spork-1.3.4/lib/knife-spork/runner.rb:138:in `environment_path': undefined method `first' for "/Users/lamont/env/sk/chef-repo/environments":String (NoMethodError)
from /Users/lamont/.rvm/gems/ruby-2.1.2/gems/knife-spork-1.3.4/lib/knife-spork/runner.rb:46:in `run_plugins'
from /Users/lamont/.rvm/gems/ruby-2.1.2/gems/knife-spork-1.3.4/lib/chef/knife/spork-bump.rb:48:in `run'
from /Users/lamont/.rvm/gems/ruby-2.1.2/gems/chef-12.0.0.alpha.0/lib/chef/knife.rb:493:in `block in run_with_pretty_exceptions'
from /Users/lamont/.rvm/gems/ruby-2.1.2/gems/chef-12.0.0.alpha.0/lib/chef/local_mode.rb:38:in `with_server_connectivity'
from /Users/lamont/.rvm/gems/ruby-2.1.2/gems/chef-12.0.0.alpha.0/lib/chef/knife.rb:492:in `run_with_pretty_exceptions'
from /Users/lamont/.rvm/gems/ruby-2.1.2/gems/chef-12.0.0.alpha.0/lib/chef/knife.rb:175:in `run'
from /Users/lamont/.rvm/gems/ruby-2.1.2/gems/chef-12.0.0.alpha.0/lib/chef/application/knife.rb:139:in `run'
from /Users/lamont/.rvm/gems/ruby-2.1.2/gems/chef-12.0.0.alpha.0/bin/knife:25:in `<top (required)>'
from /Users/lamont/.rvm/gems/ruby-2.1.2/bin/knife:23:in `load'
from /Users/lamont/.rvm/gems/ruby-2.1.2/bin/knife:23:in `<main>'
from /Users/lamont/.rvm/gems/ruby-2.1.2/bin/ruby_executable_hooks:15:in `eval'
from /Users/lamont/.rvm/gems/ruby-2.1.2/bin/ruby_executable_hooks:15:in `<main>'
Aha - good spot. I think I'm going to go through everywhere I'm parsing config paths etc and make sure they're handling all the cases they should be. I'll include fixing that here too :)
:+1:
@lamont-granquist could I get you to try out https://github.com/jonlives/knife-spork/releases/tag/1.4.0.beta.1 please, and see if it fixes the issue for you? It's built from the 1.4.0 branch, this being the relevant commit: https://github.com/jonlives/knife-spork/commit/2ee8f2f8947d32c5c5f047d5adbe328e56a812ef
So, "Using knife-spork 1.3.4 from git://github.com/jonlives/knife-spork.git (at 1.4.0.beta.1)"
Still getting this:
% knife spork bump sk_role_base -VV
FATAL: No default cookbook_path; Specify with -o or fix your knife.rb.
USAGE: knife spork bump COOKBOOK [major|minor|patch|manual]
-s, --server-url URL Chef Server URL
[...etc...]
@lamont-granquist could I please just check that you installed the 1.4.0.1.beta.1 gem from the page I linked? Just cos you mentioned 1.3.4 above...if you are, I'll need to take another look at what mixlib-shellout's doing, cos that beta release is doing this now: https://github.com/jonlives/knife-spork/blob/1.4.0/lib/knife-spork/runner.rb#L286
Yeah, I think bundler is drunk.
I need more coffee and it would help if my cable modem stopped rebooting every 5 mins...
So, I don't think that commit is in the 1.4.0.beta.1 tag.... Yeah, just using "1.4.0" works a lot better..
% knife spork bump sk_role_base -VV
Successfully bumped sk_role_base to v0.0.20!
:shipit:
Ah I may have tagged before pushing to the remote branch or something. It was a coffee-lacking day here too. Excellent, glad that works. I'll get it out in the 1.4.0 release.
Released in 1.4.0
I've got a chef_repo_path set, and Chef::Config should derive cookbook_path from that setting, so I'm fairly confused as to why knife-spork can't find cookbook_path.
It also clearly seems to assume that environment_path must be an array, when it can also be a string: