DEBUG: testing increase timeout for tripleo CI.
If that's working maybe do https://review.openstack.org/334011 Change-Id: Id428b112eeaa22ecef78a21032b0c1dcc0ac0592
This commit is contained in:
@@ -15,7 +15,9 @@ class Puppet::Provider::Openstack < Puppet::Provider
|
|||||||
|
|
||||||
@@no_retry_actions = %w(create remove delete)
|
@@no_retry_actions = %w(create remove delete)
|
||||||
@@command_timeout = 20
|
@@command_timeout = 20
|
||||||
@@request_timeout = 60
|
# Fails on the 8th retry for a max of 181s (~3min) before total
|
||||||
|
# failure.
|
||||||
|
@@request_timeout = 170
|
||||||
@@retry_sleep = 3
|
@@retry_sleep = 3
|
||||||
class << self
|
class << self
|
||||||
[:no_retry_actions, :request_timeout, :retry_sleep].each do |m|
|
[:no_retry_actions, :request_timeout, :retry_sleep].each do |m|
|
||||||
@@ -46,7 +48,7 @@ class Puppet::Provider::Openstack < Puppet::Provider
|
|||||||
openstack_command *args
|
openstack_command *args
|
||||||
end
|
end
|
||||||
rescue Timeout::Error
|
rescue Timeout::Error
|
||||||
raise Puppet::ExecutionFailure, "Command: 'openstack #{args.inspect}' has been running for more then #{command_timeout(action)} seconds!"
|
raise Puppet::ExecutionFailure, "Command: 'openstack #{args.inspect}' has been running for more then #{command_timeout(action)} seconds"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -74,6 +76,8 @@ class Puppet::Provider::Openstack < Puppet::Provider
|
|||||||
Puppet::Util.withenv(env) do
|
Puppet::Util.withenv(env) do
|
||||||
rv = nil
|
rv = nil
|
||||||
end_time = current_time + request_timeout
|
end_time = current_time + request_timeout
|
||||||
|
start_time = current_time
|
||||||
|
retry_count = 0
|
||||||
loop do
|
loop do
|
||||||
begin
|
begin
|
||||||
if action == 'list'
|
if action == 'list'
|
||||||
@@ -110,10 +114,16 @@ class Puppet::Provider::Openstack < Puppet::Provider
|
|||||||
break
|
break
|
||||||
rescue Puppet::ExecutionFailure => exception
|
rescue Puppet::ExecutionFailure => exception
|
||||||
raise Puppet::Error::OpenstackUnauthorizedError, 'Could not authenticate' if exception.message =~ /HTTP 40[13]/
|
raise Puppet::Error::OpenstackUnauthorizedError, 'Could not authenticate' if exception.message =~ /HTTP 40[13]/
|
||||||
raise exception if current_time > end_time
|
if current_time > end_time
|
||||||
|
error_message = exception.message
|
||||||
|
error_message += " (tried #{retry_count}, for a total of #{end_time - start_time } seconds)"
|
||||||
|
raise(Puppet::ExecutionFailure, error_message)
|
||||||
|
end
|
||||||
|
|
||||||
raise exception if no_retry_actions.include? action
|
raise exception if no_retry_actions.include? action
|
||||||
debug "Non-fatal error: '#{exception.message}'. Retrying for #{end_time - current_time} more seconds"
|
debug "Non-fatal error: '#{exception.message}'. Retrying for #{end_time - current_time} more seconds"
|
||||||
sleep retry_sleep
|
sleep retry_sleep
|
||||||
|
retry_count += 1
|
||||||
retry
|
retry
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@@ -103,7 +103,7 @@ name="test"
|
|||||||
.times(3)
|
.times(3)
|
||||||
provider.class.stubs(:sleep)
|
provider.class.stubs(:sleep)
|
||||||
provider.class.stubs(:current_time)
|
provider.class.stubs(:current_time)
|
||||||
.returns(0, 10, 10, 20, 20, 100, 100)
|
.returns(0, 10, 10, 20, 20, 180, 180)
|
||||||
expect do
|
expect do
|
||||||
Puppet::Provider::Openstack.request('project', 'list', ['--long'])
|
Puppet::Provider::Openstack.request('project', 'list', ['--long'])
|
||||||
end.to raise_error Puppet::ExecutionFailure, /Unable to establish connection/
|
end.to raise_error Puppet::ExecutionFailure, /Unable to establish connection/
|
||||||
|
Reference in New Issue
Block a user