Skip to content
This repository has been archived by the owner on Mar 19, 2022. It is now read-only.

Librarian-Chef is not run by default when SoloCook/Bootstrap invoked from ruby #221

Merged
merged 2 commits into from
Mar 28, 2013

Conversation

tmatilai
Copy link
Collaborator

When running e.g. knife bootstrap --solo (from #207) or knife digital_ocean droplet create --solo (from knife-digital_ocean), librarian-chef is not run as config[:librarian] is not set to its default value, true.

I'm quite sure this is connected with a Knife/mixlib-cli issue about handling boolean values. But anyway we have to fix it ourselves now.

@tmatilai
Copy link
Collaborator Author

Okay, ready for review.

@matschaffer
Copy link
Owner

Nice find. Can we file a chef issue and note the number here in hopes that we can take this fix out eventually?

@matschaffer
Copy link
Owner

For example:

# Remove this when CHEF-1234 gets closed

Something like that for whatever project you think is best.

@tmatilai
Copy link
Collaborator Author

After a lot of chatting, code reading and testing the result was that this is not mixlib-cli bug but more of a Knife feature. The config hash is not initialized by default when a Knife class is initialized. In Chef 11 we could maybe call Knife#merge_config or something, but much easier to drop the :default attribute and handle the default value later in the code as in this PR is already done. This way we do not add any extra line to Knife::Bootstrap etc.

The commit messages should be improved though.

Add a Chef 10 compatible way of getting correct precedence for command line
and configuration file options. Adds correct handling of `false` values
to the original example in
http://docs.opscode.com/breaking_changes_chef_11.html#knife-configuration-parameter-changes
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.
@tmatilai
Copy link
Collaborator Author

Mat, I added comments and improved the commit messages. Better?

tmatilai added a commit that referenced this pull request Mar 28, 2013
Librarian-Chef is not run by default when SoloCook/Bootstrap invoked from ruby
@tmatilai tmatilai merged commit 538839c into matschaffer:master Mar 28, 2013
tmatilai added a commit to tmatilai/knife-solo that referenced this pull request Mar 28, 2013
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants