1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Removing accelerate_timeout as a playbook option

This will remain in ansible.cfg only.
This commit is contained in:
James Cammarata 2013-10-01 15:33:18 -05:00
parent d317103371
commit 8c17711247
4 changed files with 3 additions and 15 deletions

View file

@ -314,7 +314,6 @@ class PlayBook(object):
transport=task.transport, sudo_pass=task.sudo_pass, is_playbook=True, transport=task.transport, sudo_pass=task.sudo_pass, is_playbook=True,
check=self.check, diff=self.diff, environment=task.environment, complex_args=task.args, check=self.check, diff=self.diff, environment=task.environment, complex_args=task.args,
accelerate=task.play.accelerate, accelerate_port=task.play.accelerate_port, accelerate=task.play.accelerate, accelerate_port=task.play.accelerate_port,
accelerate_timeout=task.play.accelerate_timeout,
error_on_undefined_vars=C.DEFAULT_UNDEFINED_VAR_BEHAVIOR error_on_undefined_vars=C.DEFAULT_UNDEFINED_VAR_BEHAVIOR
) )
@ -456,7 +455,6 @@ class PlayBook(object):
transport=play.transport, sudo_pass=self.sudo_pass, is_playbook=True, module_vars=play.vars, transport=play.transport, sudo_pass=self.sudo_pass, is_playbook=True, module_vars=play.vars,
default_vars=play.default_vars, check=self.check, diff=self.diff, default_vars=play.default_vars, check=self.check, diff=self.diff,
accelerate=play.accelerate, accelerate_port=play.accelerate_port, accelerate=play.accelerate, accelerate_port=play.accelerate_port,
accelerate_timeout=play.accelerate_timeout
).run() ).run()
self.stats.compute(setup_results, setup=True) self.stats.compute(setup_results, setup=True)

View file

@ -30,7 +30,7 @@ class Play(object):
__slots__ = [ __slots__ = [
'hosts', 'name', 'vars', 'default_vars', 'vars_prompt', 'vars_files', 'hosts', 'name', 'vars', 'default_vars', 'vars_prompt', 'vars_files',
'handlers', 'remote_user', 'remote_port', 'included_roles', 'accelerate', 'handlers', 'remote_user', 'remote_port', 'included_roles', 'accelerate',
'accelerate_port', 'accelerate_timeout', 'sudo', 'sudo_user', 'transport', 'playbook', 'accelerate_port', 'sudo', 'sudo_user', 'transport', 'playbook',
'tags', 'gather_facts', 'serial', '_ds', '_handlers', '_tasks', 'tags', 'gather_facts', 'serial', '_ds', '_handlers', '_tasks',
'basedir', 'any_errors_fatal', 'roles', 'max_fail_pct' 'basedir', 'any_errors_fatal', 'roles', 'max_fail_pct'
] ]
@ -40,7 +40,7 @@ class Play(object):
VALID_KEYS = [ VALID_KEYS = [
'hosts', 'name', 'vars', 'vars_prompt', 'vars_files', 'hosts', 'name', 'vars', 'vars_prompt', 'vars_files',
'tasks', 'handlers', 'remote_user', 'user', 'port', 'include', 'accelerate', 'accelerate_port', 'tasks', 'handlers', 'remote_user', 'user', 'port', 'include', 'accelerate', 'accelerate_port',
'accelerate_timeout', 'sudo', 'sudo_user', 'connection', 'tags', 'gather_facts', 'serial', 'sudo', 'sudo_user', 'connection', 'tags', 'gather_facts', 'serial',
'any_errors_fatal', 'roles', 'pre_tasks', 'post_tasks', 'max_fail_percentage' 'any_errors_fatal', 'roles', 'pre_tasks', 'post_tasks', 'max_fail_percentage'
] ]
@ -114,7 +114,6 @@ class Play(object):
self.any_errors_fatal = utils.boolean(ds.get('any_errors_fatal', 'false')) self.any_errors_fatal = utils.boolean(ds.get('any_errors_fatal', 'false'))
self.accelerate = utils.boolean(ds.get('accelerate', 'false')) self.accelerate = utils.boolean(ds.get('accelerate', 'false'))
self.accelerate_port = ds.get('accelerate_port', None) self.accelerate_port = ds.get('accelerate_port', None)
self.accelerate_timeout = int(ds.get('accelerate_timeout', 300))
self.max_fail_pct = int(ds.get('max_fail_percentage', 100)) self.max_fail_pct = int(ds.get('max_fail_percentage', 100))
load_vars = {} load_vars = {}

View file

@ -136,7 +136,6 @@ class Runner(object):
error_on_undefined_vars=C.DEFAULT_UNDEFINED_VAR_BEHAVIOR, # ex. False error_on_undefined_vars=C.DEFAULT_UNDEFINED_VAR_BEHAVIOR, # ex. False
accelerate=False, # use accelerated connection accelerate=False, # use accelerated connection
accelerate_port=None, # port to use with accelerated connection accelerate_port=None, # port to use with accelerated connection
accelerate_timeout=None, # number of seconds to wait for a response on the accelerated connection
): ):
# used to lock multiprocess inputs and outputs at various levels # used to lock multiprocess inputs and outputs at various levels
@ -180,7 +179,6 @@ class Runner(object):
self.error_on_undefined_vars = error_on_undefined_vars self.error_on_undefined_vars = error_on_undefined_vars
self.accelerate = accelerate self.accelerate = accelerate
self.accelerate_port = accelerate_port self.accelerate_port = accelerate_port
self.accelerate_timeout = accelerate_timeout
self.callbacks.runner = self self.callbacks.runner = self
self.original_transport = self.transport self.original_transport = self.transport
@ -583,12 +581,6 @@ class Runner(object):
actual_transport = "accelerate" actual_transport = "accelerate"
if not self.accelerate_port: if not self.accelerate_port:
self.accelerate_port = C.ACCELERATE_PORT self.accelerate_port = C.ACCELERATE_PORT
try:
if not self.accelerate_timeout:
self.accelerate_timeout = C.ACCELERATE_TIMEOUT
self.accelerate_timeout = int(self.accelerate_timeout)
except:
raise errors.AnsibleError("invalid value for the accelerate_timeout parameter")
if actual_transport in [ 'paramiko', 'ssh', 'accelerate' ]: if actual_transport in [ 'paramiko', 'ssh', 'accelerate' ]:
actual_port = inject.get('ansible_ssh_port', port) actual_port = inject.get('ansible_ssh_port', port)

View file

@ -100,7 +100,6 @@ class Connection(object):
try: try:
if not self.is_connected: if not self.is_connected:
# TODO: make the timeout and retries configurable?
tries = 3 tries = 3
self.conn = socket.socket() self.conn = socket.socket()
self.conn.settimeout(constants.ACCELERATE_CONNECT_TIMEOUT) self.conn.settimeout(constants.ACCELERATE_CONNECT_TIMEOUT)
@ -116,7 +115,7 @@ class Connection(object):
if tries == 0: if tries == 0:
vvv("Could not connect via the accelerated connection, exceeded # of tries") vvv("Could not connect via the accelerated connection, exceeded # of tries")
raise errors.AnsibleError("Failed to connect") raise errors.AnsibleError("Failed to connect")
self.conn.settimeout(self.runner.accelerate_timeout) self.conn.settimeout(constants.ACCELERATE_TIMEOUT)
except: except:
if allow_ssh: if allow_ssh:
vvv("Falling back to ssh to startup accelerated mode") vvv("Falling back to ssh to startup accelerated mode")