Skip to content

Commit

Permalink
Expose virt-v2v-wrapper error message in progress.states
Browse files Browse the repository at this point in the history
  • Loading branch information
fabiendupont committed Mar 18, 2019
1 parent 71fb5b8 commit b5d5255
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ def main
@handle.set_state_var(:ae_state_progress, 'message' => message, 'percent' => percent.round(2))
set_retry
when 'failed'
@handle.set_state_var(:ae_state_progress, 'message' => 'Disks transformation failed.')
raise "Disks transformation failed."
message = @task.get_option(:virtv2v_message)
raise message
when 'succeeded'
@handle.set_state_var(:ae_state_progress, 'message' => 'Disks transformation succeeded.', 'percent' => 100)
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,10 @@

context "conversion has failed" do
it "raises with a message stating conversion has failed" do
errormsg = 'virtv2v failed somehow'
ae_service.root['ae_state_retries'] = 2
allow(svc_model_task).to receive(:get_option).with(:virtv2v_status).and_return('failed')
errormsg = 'Disks transformation failed.'
allow(svc_model_task).to receive(:get_option).with(:virtv2v_message).and_return(errormsg)
expect { described_class.new(ae_service).main }.to raise_error(errormsg)
expect(ae_service.get_state_var(:ae_state_progress)).to eq('message' => errormsg)
end
Expand Down

0 comments on commit b5d5255

Please sign in to comment.