Skip to content

Commit

Permalink
option for custom error messages instead of path for error message
Browse files Browse the repository at this point in the history
  • Loading branch information
timothysmith0609 committed Nov 26, 2018
1 parent 2b72f93 commit c8d51d5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/kubernetes-deploy/kubernetes_resource/custom_resource.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,11 @@ def deploy_failed?
def failure_message
messages = rollout_params[:failure_queries].map do |query|
next unless JsonPath.new(query[:path]).first(@instance_data) == query[:value]
JsonPath.new(query[:error_msg_path]).first(@instance_data) if query[:error_msg_path]
if query[:custom_error_msg]
query[:custom_error_msg]
else
JsonPath.new(query[:error_msg_path]).first(@instance_data) if query[:error_msg_path]
end
end.compact
messages.present? ? messages.join("\n") : "error deploying #{id}"
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ def validate_params(params)
params[:failure_queries].each do |query|
JsonPath.new(query[:path])
JsonPath.new(query[:error_msg_path]) if query[:error_msg_path]
raise RuntimeError if query[:custom_error_msg] && !query[:custom_error_msg].is_a?(String)
end
rescue RuntimeError => e
raise FatalDeploymentError, "error parsing JsonPath expression for custom resource params: #{e.message}"
Expand Down

0 comments on commit c8d51d5

Please sign in to comment.