Class: Chef::Knife
- Inherits:
-
Object
- Object
- Chef::Knife
- Includes:
- StencilBase
- Defined in:
- lib/chef/knife/stencil_base.rb,
lib/chef/knife/stencil_file.rb,
lib/chef/knife/stencil_node.rb,
lib/chef/knife/stencil_collection.rb,
lib/chef/knife/stencil_monkey_patch.rb,
lib/chef/knife/stencil_server_create.rb,
lib/chef/knife/stencil_server_delete.rb,
lib/chef/knife/stencil_server_explain.rb
Direct Known Subclasses
StencilServerCreate, StencilServerDelete, StencilServerExplain
Defined Under Namespace
Modules: StencilBase Classes: StencilCollection, StencilFile, StencilNode, StencilServerCreate, StencilServerDelete, StencilServerExplain
Instance Method Summary collapse
Methods included from StencilBase
#build_plugin_klass, #explain, #invoked_as_stencil?, #locate_config_value, #normalize_path, #stencil_root
Instance Method Details
#config ⇒ Object
56 57 58 |
# File 'lib/chef/knife/stencil_monkey_patch.rb', line 56 def config return Chef::Config[:knife] end |
#merge_configs ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/chef/knife/stencil_monkey_patch.rb', line 26 def merge_configs # Apply config file settings on top of mixlib-cli defaults combined_config = default_config.merge(config_file_settings) # Apply user-supplied options on top of the above combination combined_config = combined_config.merge(config) # replace the config hash from mixlib-cli with our own. # Need to use the mutate-in-place #replace method instead of assigning to # the instance variable because other code may have a reference to the # original config hash object. config.replace(combined_config) # If the stencil plugin has been invoked, parse some additional configuration # from the stencils. if invoked_as_stencil? new_config = config stencil_collection = Knife::StencilCollection.new stencil_collection.for_name(locate_config_value(:chef_node_name)).each do |stencil| new_config.merge!(stencil.) end config.replace(new_config) combined_config = config config.each_pair do |k,v| Chef::Config[:knife][k.to_sym] = v end end end |