Skip to content

Commit

Permalink
Reset ae_reason and ae_result in check_refreshed when
Browse files Browse the repository at this point in the history
refresh_may_have_completed is true.

The update_result and update_reason state_vars contained the
previous values.  The state_var update_result
value was still set to retry from the previous execution which caused
the state machine to retry instead of proceeding to the next state.
It had another side affect in that the retry was set with no retry
interval which caused the state machine to retry immediately instead of
waiting the usual time interval.

Resetting those values caused the state machine to progress to the next
state and complete successfully.

Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1720212
  • Loading branch information
tinaafitz committed Jul 7, 2019
1 parent 4e7cd98 commit d1f803b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,10 @@ def check_refreshed(service)
@handle.log("info", "Check refresh status of stack (#{service.stack_name})")

if refresh_may_have_completed?(service)
@handle.root['ae_result'] = @handle.get_state_var('update_result')
@handle.root['ae_reason'] = @handle.get_state_var('update_reason')
@handle.root['ae_result'] = 'ok'
@handle.root['ae_reason'] = ''
@handle.set_state_var('update_result', @handle.root['ae_result'])
@handle.set_state_var('update_reason', @handle.root['ae_reason'])
else
@handle.root['ae_result'] = 'retry'
@handle.root['ae_retry_interval'] = '30.seconds'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@
end

context "with a service" do
let(:update_result) { 'ae_result' }
let(:update_reason) { 'ae_reason' }
let(:update_result) { 'ok' }
let(:update_reason) { '' }

before do
allow(svc_model_service_reconfigure_task).to receive(:source).and_return(svc_model_service)
Expand Down Expand Up @@ -95,7 +95,6 @@
allow(svc_model_service).to receive(:orchestration_stack_status)
.and_return(['rollback_complete', update_reason])

expect(svc_model_service_reconfigure_task).to receive(:user_message=).with(update_reason)
described_class.new(ae_service).main
expect(ae_service.get_state_var('update_result')).to eq('error')
expect(ae_service.get_state_var('update_reason')).to eq(update_reason)
Expand Down

0 comments on commit d1f803b

Please sign in to comment.