Class: Chef::Config

Inherits:
Object show all
Extended by:
Mixlib::Config
Defined in:
lib/chef/config.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.add_formatter(name, file_path = nil) ⇒ Object



66
67
68
# File 'lib/chef/config.rb', line 66

def self.add_formatter(name, file_path=nil)
  formatters << [name, file_path]
end

.formattersObject



70
71
72
# File 'lib/chef/config.rb', line 70

def self.formatters
  @formatters ||= []
end

.inspectObject



47
48
49
# File 'lib/chef/config.rb', line 47

def self.inspect
  configuration.inspect
end

.manage_secret_keyObject

Manages the chef secret session key

Returns

<newkey>

A new or retrieved session key



34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/chef/config.rb', line 34

def self.manage_secret_key
  newkey = nil
  if Chef::FileCache.has_key?("chef_server_cookie_id")
    newkey = Chef::FileCache.load("chef_server_cookie_id")
  else
    chars = ("a".."z").to_a + ("A".."Z").to_a + ("0".."9").to_a
    newkey = ""
    40.times { |i| newkey << chars[rand(chars.size-1)] }
    Chef::FileCache.store("chef_server_cookie_id", newkey)
  end
  newkey
end

.platform_specific_path(path) ⇒ Object



53
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/chef/config.rb', line 53

def self.platform_specific_path(path)
  if RUBY_PLATFORM =~ /mswin|mingw|windows/
    # turns /etc/chef/client.rb into C:/chef/client.rb
    system_drive = ENV['SYSTEMDRIVE'] ? ENV['SYSTEMDRIVE'] : ""
    path = File.join(system_drive, Chef::Config[:alt_root].split('/'), path.split('/')[2..-1])
    # ensure all forward slashes are backslashes
    path.gsub!(File::SEPARATOR, (File::ALT_SEPARATOR || '\\'))
  else
    path = File.join(Chef::Config[:alt_root], path)
  end
  path
end

Instance Method Details

#nilObject

Daemonization Settings ## What user should Chef run as?



179
# File 'lib/chef/config.rb', line 179

user nil