class ChefConfig::WorkstationConfigLoader
def apply_credentials(creds, profile)
def apply_credentials(creds, profile) # Store the profile used in case other things want it. Config.profile ||= profile # Validate the credentials data. if creds.key?("node_name") && creds.key?("client_name") raise ChefConfig::ConfigurationError, "Do not specify both node_name and client_name. You should prefer client_name." end # Load credentials data into the Chef configuration. creds.each do |key, value| case key.to_s when "client_name" # Special case because it's weird to set your username via `node_name`. Config.node_name = value when "validation_key", "validator_key" extract_key(value, :validation_key, :validation_key_contents) when "client_key" extract_key(value, :client_key, :client_key_contents) when "knife" Config.knife.merge!(value.transform_keys(&:to_sym)) else Config[key.to_sym] = value end end @credentials_found = true end