Skip to content

Commit

Permalink
Make hound happy
Browse files Browse the repository at this point in the history
(cherry picked from commit 1442925)
(cherry picked from commit b6b44c3)
  • Loading branch information
vuntz committed Jun 20, 2017
1 parent e64e4a1 commit 5d1b187
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 4 deletions.
4 changes: 3 additions & 1 deletion crowbar_framework/app/controllers/barclamp_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -626,7 +626,9 @@ def proposal_update
@proposal["deployment"][params[:barclamp]] = JSON.parse(params[:proposal_deployment])
@service_object.save_proposal!(@proposal)
# validation already happened on save
answer = @service_object.proposal_commit(params[:name], validate: false, validate_after_save: false)
answer = @service_object.proposal_commit(params[:name],
validate: false,
validate_after_save: false)
flash[:alert] = answer[1] if answer[0] >= 400
flash[:notice] = answer[1] if answer[0] >= 300 and answer[0] < 400
flash[:notice] = t("barclamp.proposal_show.commit_proposal_success") if answer[0] == 200
Expand Down
7 changes: 6 additions & 1 deletion crowbar_framework/app/models/crowbar_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,12 @@ def role_constraints
# Unfortunatelly we need to explicitely look at crowbar-status of the proposal
# because apply_role from this model ignores errors from superclass's apply_role.
def commit_and_check_proposal
answer = proposal_commit("default", in_queue: false, validate: false, validate_after_save: false)
answer = proposal_commit(
"default",
in_queue: false,
validate: false,
validate_after_save: false
)
# check if error message is saved in one of the nodes
if answer.first != 200
found_errors = []
Expand Down
4 changes: 3 additions & 1 deletion crowbar_framework/app/models/service_object.rb
Original file line number Diff line number Diff line change
Expand Up @@ -569,7 +569,9 @@ def proposal_commit(inst, options = {})
begin
# Put mark on the wall
prop["deployment"][@bc_name]["crowbar-committing"] = true
save_proposal!(prop, validate: options[:validate], validate_after_save: options[:validate_after_save])
save_proposal!(prop,
validate: options[:validate],
validate_after_save: options[:validate_after_save])
response = active_update(prop.raw_data, inst, options[:in_queue])
rescue Chef::Exceptions::ValidationFailed => e
@logger.error ([e.message] + e.backtrace).join("\n")
Expand Down
7 changes: 6 additions & 1 deletion crowbar_framework/lib/crowbar/deployment_queue.rb
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,12 @@ def commit_proposal(bc, inst)
service = eval("#{bc.camelize}Service.new logger")

# This will call apply_role and chef-client.
status, message = service.proposal_commit(inst, in_queue: true, validate: false, validate_after_save: false)
status, message = service.proposal_commit(
inst,
in_queue: true,
validate: false,
validate_after_save: false
)

logger.debug("process queue: committed item #{bc}:#{inst}: results = #{message.inspect}")

Expand Down

0 comments on commit 5d1b187

Please sign in to comment.