-
Notifications
You must be signed in to change notification settings - Fork 213
Allow configuration of solo.rb via knife.rb #199
Conversation
My suggestion (like in this comment) is to use the standard Knife configuration options from knife.rb/Chef::Config. For example each directory in I guess we just have to make a spike to see how this works out. |
Btw: I'm just playing around with how to adapt the cookbooks path, so my first attempt was to add this to
and then use a customized
While this works for now, I'd definitely prefer to override only a specific parts, i.e. only adapt In my ideal world:
I also noticed that adding |
Just to give you a heads-up about the current state master:
It seems like it is just not implemented yet (I thought so because of the "1 - Ready" label on this issue). |
btw: any plans on pushing out another pre version ( |
Yeah, let me run one now. It should at least fix the windows issues we've -Mat about.me/matschaffer On Wed, Feb 20, 2013 at 5:01 AM, tknerr notifications@github.com wrote:
|
@tknerr the 'ready' tag means it's on the backlog (http://huboard.com/matschaffer/knife-solo/board). 'Done' would be actually finished and merged. The prototype is on this branch but it will probably change again. I'm struggling quite a bit trying to get this one right. |
@matschaffer thanks for pushing 0.3.0.pre2! Didn't know about huboard yet, but looks nice :-) |
Thank @tmatilai for that find. So far so good. I'm also using it on a -Mat about.me/matschaffer On Wed, Feb 20, 2013 at 9:46 AM, tknerr notifications@github.com wrote:
|
Thanks @tmatilai :-) |
No, thanks to my twitter feed. =) |
Fixes #212 Will probably break windows nodes where shell is cmd.exe-based
Just don't try to transfer it if it's missing.
Since we rely on knife.rb and controlling the resulting paths, this config object seemed like more overhead than we need.
option :provisioning_path, | ||
:long => '--provisioning-path path', | ||
:description => 'Where to store kitchen data on the node', | ||
:default => '~/chef-solo' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The current handling for this option works fine with Chef 11, but in Chef 10 this does not make possible to set the default value in knife.rb. There are many ways to fix it, but I think a good one would be to follow this (with a fix for --no-options). I.e. remove the :default attribute here, and add methods:
def locate_config_value(key)
key = key.to_sym
config[key].nil? ? Chef::Config[:knife][key] : config[key]
end
def provisioning_path
locate_config_value(:provisioning_path) || '~/chef-solo'
end
I had a plan to unify the option handling overall after this issue is merged, but this is a good place start.
NOTE: This is redundant after matschaffer#199 is merged rel matschaffer#212. Ohai doesn't like relative reference to solo.rb Currently this is unix only. Not sure if this issue is still valid on windows. Need to adjust fix to return original path on windows boxes.
@matschaffer I guess you are quite busy, so would you like that I try to address the issues I found? I should have some spare time in Easter. |
@matschaffer Here are my suggestions for this branch: tmatilai/knife-solo@3c4b2d0...issue;knife-rb-configuration-199 |
Love it. Do you feel like it's ready to go otherwise? If so perhaps it's -Mat about.me/matschaffer On Thu, Apr 4, 2013 at 12:02 AM, Teemu Matilainen
|
I think this is quite ready. I'll make the last changes to #207 and merge it first. Then merge the new master before my changes. My branch is now built on top of #207. I'll try to do all this later today. After that a new pre-release would be a good idea. Documentation and upgrade instructions need some attention, too. And I think it would be a good idea to warn and inform the user if solo.rb is found in the kitchen, no? |
Agreed with all above. Including the solo.rb presence. -Mat about.me/matschaffer On Thu, Apr 4, 2013 at 9:33 AM, Teemu Matilainen
|
Conflicts: Manifest.txt knife-solo.gemspec lib/chef/knife/solo_cook.rb
Allows setting the value in knife.rb with Chef 10, too.
Set the provisioning_path dir mode so that it is not world-readable. Fixes #1.
Avoid possible collisions between user cookbook directories, our patch cookbooks and future Berkshelf integration.
It is common to specify it as a string if there is only one cookbook directory.
Chef/Knife configuration for cookbook_path etc. defaults to system paths. So unless the user has configured her knife.rb, the paths don't normally exist.
The latest rendition of this uses .chef/knife.rb entirely and munges all paths into a generated solo.rb.
Changing the root "provisioning path" (name borrowed from vagrant) can be done via command line switch.
The rest is not customizable on the node and is considered an implementation detail. Instead this will read all of the local knife.rb configurations and use them as the source path during rsync.
This is working well in my testing so far, but the downside is that we now rsync everything separately which makes all this even slower given the ssh connection overhead.
I'm inclined to accept that for now since it's puts more pressure on the planned ssh-connection refactoring which should really happen anyway.
My hope is that this will also allow us to integrate with berkshelf without having to copy cookbooks into the kitchen explicitly. Which would be awesome.
For testing the latest version, just remove solo.rb and re-run
knife solo init .
to generate.chef/knife.rb
. Or if you have one already just make sure it includes the items listed in the example.