Module: ChefDK::Configurable

Instance Method Summary collapse

Instance Method Details

#chef_configObject



50
51
52
53
54
55
56
# File 'lib/chef-dk/configurable.rb', line 50

def chef_config
  return @chef_config if @chef_config
  config_loader.load
  @chef_config = Chef::Config
  CookbookOmnifetch.integration.default_chef_server_http_client = default_chef_server_http_client
  @chef_config
end

#chefdk_configObject



58
59
60
# File 'lib/chef-dk/configurable.rb', line 58

def chefdk_config
  chef_config.chefdk
end

#config_loaderObject



62
63
64
# File 'lib/chef-dk/configurable.rb', line 62

def config_loader
  @config_loader ||= Chef::WorkstationConfigLoader.new(config[:config_file])
end

#default_chef_server_http_clientObject



79
80
81
82
83
84
85
# File 'lib/chef-dk/configurable.rb', line 79

def default_chef_server_http_client
  lambda do
    ChefServerAPIMulti.new(@chef_config.chef_server_url,
                           signing_key_filename: @chef_config.client_key,
                           client_name: @chef_config.node_name)
  end
end

#generator_configObject



66
67
68
# File 'lib/chef-dk/configurable.rb', line 66

def generator_config
  chefdk_config.generator
end

#knife_configObject



70
71
72
# File 'lib/chef-dk/configurable.rb', line 70

def knife_config
  chef_config.knife
end

#reset_config!Object



74
75
76
77
# File 'lib/chef-dk/configurable.rb', line 74

def reset_config!
  @chef_config = nil
  @config_loader = nil
end