Class: Chef::Knife::Bootstrap

Inherits:
Object
  • Object
show all
Defined in:
lib/hazetug/tug/knife_base.rb

Overview

Extend knife bootstrap context with our data. It’s monkey patching, yey :)

Instance Method Summary collapse

Instance Method Details

#add_variable_to_bootstrap_context(variable_sym, value) ⇒ Object



19
20
21
22
# File 'lib/hazetug/tug/knife_base.rb', line 19

def add_variable_to_bootstrap_context(variable_sym, value)
  @extended_bootstrap_variables ||= {}
  @extended_bootstrap_variables[variable_sym] = value if value
end

#render_template(template = nil) ⇒ Object



11
12
13
14
15
16
17
# File 'lib/hazetug/tug/knife_base.rb', line 11

def render_template(template=nil)
  context = Chef::Knife::Core::BootstrapContext.new(config, config[:run_list], Chef::Config)
  @extended_bootstrap_variables.each do |s, v|
    context.instance_variable_set(s, v)
  end
  Erubis::Eruby.new(template).evaluate(context)
end