Module: ChefCLI::Configurable

Instance Method Summary collapse

Instance Method Details

#chef_configObject



50
51
52
53
54
55
56
57
# File 'lib/chef-cli/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

#chefcli_configObject



59
60
61
# File 'lib/chef-cli/configurable.rb', line 59

def chefcli_config
  chef_config.chefcli
end

#config_loaderObject



63
64
65
66
67
68
69
# File 'lib/chef-cli/configurable.rb', line 63

def config_loader
  if !config[:profile].nil?
    @config_loader ||= Chef::WorkstationConfigLoader.new(config[:config_file], profile: config[:profile])
  else
    @config_loader ||= Chef::WorkstationConfigLoader.new(config[:config_file])
  end
end

#default_chef_server_http_clientObject



84
85
86
87
88
89
90
# File 'lib/chef-cli/configurable.rb', line 84

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



71
72
73
# File 'lib/chef-cli/configurable.rb', line 71

def generator_config
  chefcli_config.generator
end

#knife_configObject



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

def knife_config
  chef_config.knife
end

#reset_config!Object



79
80
81
82
# File 'lib/chef-cli/configurable.rb', line 79

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