From 8c177112475ba1d0ebe3173210433ad688f67f0d Mon Sep 17 00:00:00 2001 From: James Cammarata Date: Tue, 1 Oct 2013 15:33:18 -0500 Subject: [PATCH] Removing accelerate_timeout as a playbook option This will remain in ansible.cfg only. --- lib/ansible/playbook/__init__.py | 2 -- lib/ansible/playbook/play.py | 5 ++--- lib/ansible/runner/__init__.py | 8 -------- lib/ansible/runner/connection_plugins/accelerate.py | 3 +-- 4 files changed, 3 insertions(+), 15 deletions(-) diff --git a/lib/ansible/playbook/__init__.py b/lib/ansible/playbook/__init__.py index f350ff9aa4..c964a53fbd 100644 --- a/lib/ansible/playbook/__init__.py +++ b/lib/ansible/playbook/__init__.py @@ -314,7 +314,6 @@ class PlayBook(object): transport=task.transport, sudo_pass=task.sudo_pass, is_playbook=True, check=self.check, diff=self.diff, environment=task.environment, complex_args=task.args, 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 ) @@ -456,7 +455,6 @@ class PlayBook(object): 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, accelerate=play.accelerate, accelerate_port=play.accelerate_port, - accelerate_timeout=play.accelerate_timeout ).run() self.stats.compute(setup_results, setup=True) diff --git a/lib/ansible/playbook/play.py b/lib/ansible/playbook/play.py index 1d617003ea..0273be841c 100644 --- a/lib/ansible/playbook/play.py +++ b/lib/ansible/playbook/play.py @@ -30,7 +30,7 @@ class Play(object): __slots__ = [ 'hosts', 'name', 'vars', 'default_vars', 'vars_prompt', 'vars_files', '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', 'basedir', 'any_errors_fatal', 'roles', 'max_fail_pct' ] @@ -40,7 +40,7 @@ class Play(object): VALID_KEYS = [ 'hosts', 'name', 'vars', 'vars_prompt', 'vars_files', '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' ] @@ -114,7 +114,6 @@ class Play(object): self.any_errors_fatal = utils.boolean(ds.get('any_errors_fatal', 'false')) self.accelerate = utils.boolean(ds.get('accelerate', 'false')) 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)) load_vars = {} diff --git a/lib/ansible/runner/__init__.py b/lib/ansible/runner/__init__.py index e336a13da4..ac22fb1399 100644 --- a/lib/ansible/runner/__init__.py +++ b/lib/ansible/runner/__init__.py @@ -136,7 +136,6 @@ class Runner(object): error_on_undefined_vars=C.DEFAULT_UNDEFINED_VAR_BEHAVIOR, # ex. False accelerate=False, # use 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 @@ -180,7 +179,6 @@ class Runner(object): self.error_on_undefined_vars = error_on_undefined_vars self.accelerate = accelerate self.accelerate_port = accelerate_port - self.accelerate_timeout = accelerate_timeout self.callbacks.runner = self self.original_transport = self.transport @@ -583,12 +581,6 @@ class Runner(object): actual_transport = "accelerate" if not self.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' ]: actual_port = inject.get('ansible_ssh_port', port) diff --git a/lib/ansible/runner/connection_plugins/accelerate.py b/lib/ansible/runner/connection_plugins/accelerate.py index 414c070c7d..c4d7e4c991 100644 --- a/lib/ansible/runner/connection_plugins/accelerate.py +++ b/lib/ansible/runner/connection_plugins/accelerate.py @@ -100,7 +100,6 @@ class Connection(object): try: if not self.is_connected: - # TODO: make the timeout and retries configurable? tries = 3 self.conn = socket.socket() self.conn.settimeout(constants.ACCELERATE_CONNECT_TIMEOUT) @@ -116,7 +115,7 @@ class Connection(object): if tries == 0: vvv("Could not connect via the accelerated connection, exceeded # of tries") raise errors.AnsibleError("Failed to connect") - self.conn.settimeout(self.runner.accelerate_timeout) + self.conn.settimeout(constants.ACCELERATE_TIMEOUT) except: if allow_ssh: vvv("Falling back to ssh to startup accelerated mode")