Improve UX for disk space shortage for dump
Displaying stderr could not work, as shotgun is called with redirecting stderr to stoud. Also, whole debug log is printed to stderr, which would cause enormous error message in UI. Special case of errno 28 is handled with custom error message. Change-Id: I92a1aa149e5edc76bb90cdd24d8e603233fdfe2f Related-bug: 1529182
This commit is contained in:
parent
dd04fc7b79
commit
78f082d41e
@ -45,9 +45,12 @@ module Astute
|
||||
if result[:data][:exit_code] == 0
|
||||
Astute.logger.info("#{ctx.task_id}: Snapshot is done.")
|
||||
report_success(ctx, result[:data][:stdout].rstrip)
|
||||
elsif result[:data][:exit_code] == 28
|
||||
Astute.logger.error("#{ctx.task_id}: Disk space for creating snapshot exceeded.")
|
||||
report_error(ctx, "Shotgun exit code: #{result[:data][:exit_code]}. Disk space for creating snapshot exceeded.")
|
||||
else
|
||||
Astute.logger.error("#{ctx.task_id}: Dump command returned non zero exit code. For details see /var/log/shotgun.log")
|
||||
report_error(ctx, "exit code: #{result[:data][:exit_code]} stderr: #{result[:data][:stderr]}")
|
||||
report_error(ctx, "Shotgun exit code: #{result[:data][:exit_code]}")
|
||||
end
|
||||
rescue Timeout::Error
|
||||
msg = "Dump is timed out"
|
||||
|
@ -60,8 +60,15 @@ describe 'dump_environment' do
|
||||
|
||||
it "should report error if shell agent returns not 0" do
|
||||
rpc_mock.expects(:upload).returns([mock_mc_result])
|
||||
rpc_mock.expects(:execute).returns(exec_result(1, '', 'stderr'))
|
||||
Astute::Dump.expects(:report_error).with(ctx, "exit code: 1 stderr: stderr")
|
||||
rpc_mock.expects(:execute).returns(exec_result(1, '', ''))
|
||||
Astute::Dump.expects(:report_error).with(ctx, "Shotgun exit code: 1")
|
||||
Astute::Dump.dump_environment(ctx, settings)
|
||||
end
|
||||
|
||||
it "should report disk space error if shell agent returns 28" do
|
||||
rpc_mock.expects(:upload).returns([mock_mc_result])
|
||||
rpc_mock.expects(:execute).returns(exec_result(28, '', ''))
|
||||
Astute::Dump.expects(:report_error).with(ctx, "Shotgun exit code: 28. Disk space for creating snapshot exceeded.")
|
||||
Astute::Dump.dump_environment(ctx, settings)
|
||||
end
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user