Merge "Avoid to report incorrect info about deployment timeout(part 2)"
This commit is contained in:
commit
9a0d869187
|
@ -52,7 +52,7 @@ module Astute
|
|||
exit code: #{response[:data][:exit_code]}")
|
||||
response
|
||||
rescue MClientTimeout, MClientError => e
|
||||
Astute.logger.debug("#{context.task_id}: cmd: #{cmd}
|
||||
Astute.logger.error("#{context.task_id}: cmd: #{cmd}
|
||||
mcollective error: #{e.message}")
|
||||
{:data => {}}
|
||||
end
|
||||
|
|
|
@ -57,8 +57,9 @@ module Astute
|
|||
:parents => true,
|
||||
:permissions => '0600'
|
||||
)
|
||||
rescue MClientTimeout, MClientError => e
|
||||
Astute.logger.error("#{context.task_id}: mcollective upload_file agent error: #{e.message}")
|
||||
end
|
||||
|
||||
end #class
|
||||
|
||||
end
|
||||
end
|
||||
|
|
|
@ -69,7 +69,7 @@ describe Astute::UpdateClusterHostsInfo do
|
|||
ctx.expects(:report_and_update_status).never
|
||||
end
|
||||
|
||||
it 'should not change deployment status if mcollective fail' do
|
||||
it 'should not change deployment status if shell exec using mcollective fail' do
|
||||
update_hosts.expects(:upload_file).twice
|
||||
update_hosts.expects(:run_shell_command).twice.returns(:data => {})
|
||||
|
||||
|
@ -94,4 +94,23 @@ describe Astute::UpdateClusterHostsInfo do
|
|||
update_hosts.process(deploy_data, ctx)
|
||||
end
|
||||
|
||||
describe '#upload_file' do
|
||||
|
||||
let(:node_uid) { 1 }
|
||||
|
||||
before(:each) do
|
||||
mock_rpcclient([{'uid' => node_uid}])
|
||||
end
|
||||
|
||||
it 'should not raise timeout error if mcollective runs out of the timeout' do
|
||||
Astute::MClient.any_instance.stubs(:mc_send).raises(Astute::MClientTimeout)
|
||||
expect { update_hosts.send(:upload_file, node_uid, "", ctx) }.to_not raise_error
|
||||
end
|
||||
|
||||
it 'should not raise mcollective error if it occurred' do
|
||||
Astute::MClient.any_instance.stubs(:mc_send).raises(Astute::MClientError)
|
||||
expect { update_hosts.send(:upload_file, node_uid, "", ctx) }.to_not raise_error
|
||||
end
|
||||
end
|
||||
|
||||
end
|
Loading…
Reference in New Issue