class Zest::BootstrapGenerator
Constants
- CONFIG_FILE_TEMPLATE
Public Class Methods
new(validation_key_file, validation_client_name, chef_server_url, encrypted_databag_secret_file, attr = {})
click to toggle source
# File lib/knife-instance/bootstrap_generator.rb, line 6 def initialize(validation_key_file, validation_client_name, chef_server_url, encrypted_databag_secret_file, attr = {}) @validation_client_name = validation_client_name @validation_key_file = validation_key_file @chef_server_url = chef_server_url @encrypted_databag_secret_file = encrypted_databag_secret_file @environment = attr[:environment] @run_list = attr[:run_list] @hostname = attr[:hostname] @color = attr[:color] @base_domain = attr[:base_domain] @domain = attr[:domain] end
Public Instance Methods
config_content()
click to toggle source
# File lib/knife-instance/bootstrap_generator.rb, line 43 def config_content <<-CONFIG require 'syslog-logger' Logger::Syslog.class_eval do attr_accessor :sync, :formatter end log_level :info log_location Logger::Syslog.new("chef-client") chef_server_url "#{@chef_server_url}" validation_client_name "#{@validation_client_name}" node_name "#{@hostname}" CONFIG end
encrypted_data_bag_secret()
click to toggle source
# File lib/knife-instance/bootstrap_generator.rb, line 34 def encrypted_data_bag_secret File.read @encrypted_databag_secret_file end
first_boot()
click to toggle source
# File lib/knife-instance/bootstrap_generator.rb, line 20 def first_boot { "run_list" => @run_list, "assigned_hostname" => @hostname, "rails" => {"cluster" => {"color" => @color}}, "base_domain" => @base_domain, "domain" => @domain }.to_json end
generate()
click to toggle source
# File lib/knife-instance/bootstrap_generator.rb, line 38 def generate template = File.read(CONFIG_FILE_TEMPLATE) Erubis::Eruby.new(template).evaluate(self) end
start_chef()
click to toggle source
# File lib/knife-instance/bootstrap_generator.rb, line 58 def start_chef "/usr/bin/chef-client -j /etc/chef/first-boot.json -E #{@environment}" end
validation_key()
click to toggle source
# File lib/knife-instance/bootstrap_generator.rb, line 30 def validation_key File.read(@validation_key_file) end