module ChefConfig::Mixin::TrainTransport
def credentials_file_path
3) #credentials_file_path from parent ($HOME/.chef/credentials)
2) /etc/chef/TARGET_MODE_HOST/credentials
1) target_mode.credentials_file
Credentials file preference:
overriding it here.
ChefConfig::Mixin::Credentials.credentials_file_path is designed around knife,
def credentials_file_path tm_config = config.target_mode profile = tm_config.host credentials_file = if tm_config.credentials_file && File.exist?(tm_config.credentials_file) tm_config.credentials_file elsif File.exist?(config.platform_specific_path("#{ChefConfig::Config.etc_chef_dir}/#{profile}/credentials")) config.platform_specific_path("#{ChefConfig::Config.etc_chef_dir}/#{profile}/credentials") else super end raise ArgumentError, "No credentials file found for target '#{profile}'" unless credentials_file raise ArgumentError, "Credentials file specified for target mode does not exist: '#{credentials_file}'" unless File.exist?(credentials_file) logger.debug("Loading credentials file '#{credentials_file}' for target '#{profile}'") credentials_file end