summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--chef-config/lib/chef-config/mixin/credentials.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/chef-config/lib/chef-config/mixin/credentials.rb b/chef-config/lib/chef-config/mixin/credentials.rb
index 4c0192fff8..0a526527e2 100644
--- a/chef-config/lib/chef-config/mixin/credentials.rb
+++ b/chef-config/lib/chef-config/mixin/credentials.rb
@@ -43,6 +43,12 @@ module ChefConfig
end
config = Tomlrb.load_file(credentials_file)
+
+ if config[profile].nil?
+ return if profile == 'default'
+ raise ChefConfig::ConfigurationError, "Profile #{profile} doesn't exist. Please add it to #{credentials_file}."
+ end
+
apply_credentials(config[profile], profile)
rescue ChefConfig::ConfigurationError
raise