module ChefConfig::Mixin::Credentials

def load_credentials(profile = nil)

Returns:
  • (void) -

Parameters:
  • profile (String, nil) -- Optional override for the active profile,

Other tags:
    See: WorkstationConfigLoader#apply_credentials -
def load_credentials(profile = nil)
  profile = credentials_profile(profile)
  config = parse_credentials_file
  return if config.nil? # No credentials, nothing to do here.
  if config[profile].nil?
    # Unknown profile name. For "default" just silently ignore, otherwise
    # raise an error.
    return if profile == "default"
    raise ChefConfig::ConfigurationError, "Profile #{profile} doesn't exist. Please add it to #{credentials_file_path}."
  end
  apply_credentials(config[profile], profile)
end