class Spaux::Chef::Client
Attributes
spaux_config[RW]
work_dir[RW]
Public Class Methods
new(work_dir, *args)
click to toggle source
Calls superclass method
# File lib/spaux/chef/client.rb, line 10 def initialize(work_dir, *args) @work_dir = work_dir chef_config = args.shift || {} spaux_config = args.shift || {} super() default_chef_config = Spaux::default_chef_config(:client) default_chef_config.each { |_,v| v.is_a?(String) && v.gsub!(/@work_dir/, @work_dir) } @config.merge! default_chef_config.merge(chef_config) default_spaux_config = Spaux::default_spaux_config @spaux_config = default_spaux_config.merge(spaux_config) @config[:raw_key] = Spaux::Chef::Key.new(@spaux_config).raw_key # ugly hack but better than another options... redefine_chef_http_authenticator @config[:raw_key] FileUtils.touch @config[:config_file] FileUtils.touch @config[:client_key] unless chef_config[:json_attribs] @config.delete(:json_attribs) if !::File.exists?(@config[:json_attribs]) end ENV['SPAUX_HOME'] = @work_dir end
Public Instance Methods
parse_options(argv=ARGV)
click to toggle source
Calls superclass method
# File lib/spaux/chef/client.rb, line 41 def parse_options(argv=ARGV) argv = [] super end
reconfigure()
click to toggle source
Calls superclass method
# File lib/spaux/chef/client.rb, line 36 def reconfigure super ::Chef::Config[:specific_recipes] = [] end
run_application()
click to toggle source
Calls superclass method
# File lib/spaux/chef/client.rb, line 46 def run_application begin super rescue SystemExit => e # just ignore chef-client exit end end
Private Instance Methods
redefine_chef_http_authenticator(key)
click to toggle source
# File lib/spaux/chef/client.rb, line 55 def redefine_chef_http_authenticator(key) ::Chef::HTTP::Authenticator.send(:define_method, 'load_signing_key') do |signing_key_filename, raw_key| @raw_key = key @key = OpenSSL::PKey::RSA.new(@raw_key) end end