-
Notifications
You must be signed in to change notification settings - Fork 213
Integrate knife-solo to knife bootstrap
#207
Conversation
Ah yes, this guy. I'm cool to merge, but it would be nice to get those integration & doc points covered. Of course if you'd rather open those as separate issues that's fine too. |
I'm not in a hurry with this. I'll write the test and a couple of lines to the readme soon. Of course any help especially with the documentation is appreciated. =) |
Oh, this one... I try to document this soon. I already have an integration test but it does not work before #221 is fixed. |
Librarian-Chef was not run by default when SoloCook/Bootstrap was invoked by for example `knife bootstrap --solo` (from matschaffer#207) or `knife digital_ocean droplet create --solo` (from knife-digital_ocean). This is probably caused by a Knife/mixlib-cli issue about handling boolean values, but we can work around it by using our own helper.
Librarian-Chef was not run by default when SoloCook/Bootstrap was invoked by for example `knife bootstrap --solo` (from matschaffer#207) or `knife digital_ocean droplet create --solo` (from knife-digital_ocean). This is probably caused by a Knife/mixlib-cli issue about handling boolean values, but we can work around it by using our own helper.
Librarian-Chef was not run by default when SoloCook/Bootstrap was invoked by for example `knife bootstrap --solo` (from matschaffer#207) or `knife digital_ocean droplet create --solo` (from knife-digital_ocean). The reason is that the `Knife.config` is not loaded by default values when the Knife class is initialized. While this could be fixed in the invoking code it is much cleaner to do moving the default value setting to later in the code. As an extra bonus, by using our `config_value` helper we also make it possible to use `knife[:librarian]` configuration option with Chef 10, too.
Add `--solo` command line option and `knife[:solo]` configuration parameter to `Knife::Bootstrap` that can be used for triggering `Knife::SoloBootstrap` instead of the normal template based chef-client bootstrap. This is especially useful with other knife plugins like knife-ec2 that invoke `knife bootstrap` after creating an server instance. Even if these plugins do not have the `--solo` option, you can put `knife[:solo] = true` in knife.rb.
Convert Debian 7 test for this.
Here we go. The integration test depends on #221 but otherwise this is ready from my part. All comments obviously welcome. |
:description => 'Bootstrap using knife-solo' | ||
|
||
# Rename and override run method | ||
alias_method :orig_run, :run |
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.
@matschaffer So... orig_run
, run_without_knife_solo
, run_with_chef_client
, run_with_template
? =)
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.
Oh actually. run_with_chef_client is nice especially if we wrap the knife
solo stuff in a run_with_knife_solo method.
-Mat
On Apr 3, 2013, at 21:23, Teemu Matilainen notifications@github.com wrote:
In lib/chef/knife/bootstrap_solo.rb:
- class Knife
- class Bootstrap
def self.load_deps
super
require 'chef/knife/solo_bootstrap'
require 'knife-solo/tools'
SoloBootstrap.load_deps
end
option :solo,
:long => '--[no-]solo',
:description => 'Bootstrap using knife-solo'
# Rename and override run method
alias_method :orig_run, :run
@matschaffer https://github.com/matschaffer So... orig_run,
run_without_knife_solo, run_with_chef_client, run_with_template? =)
—
Reply to this email directly or view it on
GitHubhttps://github.com//pull/207/files#r3648480
.
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.
Roger. Originally I was using another method but then after the line count had reduced (while knife-solo gained more and more compatibility), I put all back to run
not to pollute Knife::Bootstrap's namespace. But I don't think the risk for collision is significative here.
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.
Makes sense. I agree with the sentiment, but I think one extra method in
the name of clarity is probably worth it.
-Mat
about.me/matschaffer
On Thu, Apr 4, 2013 at 7:51 AM, Teemu Matilainen
notifications@github.comwrote:
In lib/chef/knife/bootstrap_solo.rb:
- class Knife
- class Bootstrap
def self.load_deps
super
require 'chef/knife/solo_bootstrap'
require 'knife-solo/tools'
SoloBootstrap.load_deps
end
option :solo,
:long => '--[no-]solo',
:description => 'Bootstrap using knife-solo'
# Rename and override run method
alias_method :orig_run, :run
Roger. Originally I was using another method but then after the line count
had reduced (while knife-solo gained more and more compatibility), I put
all back to run not to pollute Knife::Bootstrap's namespace. But I don't
think the risk for collision is significative here.—
Reply to this email directly or view it on GitHubhttps://github.com//pull/207/files#r3653608
.
More informative than `orig_run`.
Integrate knife-solo to `knife bootstrap` Monkey patch Knife::Bootstrap to include `--solo` option (and `knife[:solo]` configuration options) to trigger `knife solo bootstrap` instead of the normal template based bootstrap.
Monkey patch Knife::Bootstrap to include
--solo
option (andknife[:solo]
configuration options) to triggerknife solo bootstrap
instead of the normal template based bootstrap.This addresses also #121.
TODO: