lib/vidar/config.rb in vidar-0.12.1 vs lib/vidar/config.rb in vidar-0.13.0
- old
+ new
@@ -45,16 +45,17 @@
def get!(key)
get(key) || fail(MissingConfigError, key)
end
def deploy_config
- deployments = get(:deployments) || {}
+ deployments = get(:deployments)
+ deployments = {} unless deployments.is_a?(Hash)
+ deployment = deployments[get!(:kubectl_context)]
- return nil unless deployments.is_a?(Hash)
-
- deployment = deployments[get!(:kubectl_context)]
-
- return nil unless deployment
+ if deployment.nil?
+ Log.error "ERROR: could not find deployment config for #{get!(:kubectl_context)} context"
+ return nil
+ end
deployment.transform_keys!(&:to_sym)
deployment.transform_values! { |value| Vidar::Interpolation.call(value, self) }
DeployConfig.new(deployment)