From fee73100c4455305973f2fb8583ee2ea8f4e1dca Mon Sep 17 00:00:00 2001 From: Toshio Kuratomi Date: Wed, 16 Mar 2016 11:20:02 -0700 Subject: [PATCH] Move BUFSIZE to __init__ since it's common to many connection plugins --- lib/ansible/plugins/connection/__init__.py | 2 ++ lib/ansible/plugins/connection/chroot.py | 4 +--- lib/ansible/plugins/connection/docker.py | 4 +--- lib/ansible/plugins/connection/jail.py | 4 +--- lib/ansible/plugins/connection/libvirt_lxc.py | 4 +--- lib/ansible/plugins/connection/zone.py | 4 +--- 6 files changed, 7 insertions(+), 15 deletions(-) diff --git a/lib/ansible/plugins/connection/__init__.py b/lib/ansible/plugins/connection/__init__.py index 8528a2e75d..315293163b 100644 --- a/lib/ansible/plugins/connection/__init__.py +++ b/lib/ansible/plugins/connection/__init__.py @@ -42,6 +42,8 @@ except ImportError: __all__ = ['ConnectionBase', 'ensure_connect'] +BUFSIZE = 65536 + def ensure_connect(func): @wraps(func) diff --git a/lib/ansible/plugins/connection/chroot.py b/lib/ansible/plugins/connection/chroot.py index 7918ac5602..65c37a0841 100644 --- a/lib/ansible/plugins/connection/chroot.py +++ b/lib/ansible/plugins/connection/chroot.py @@ -28,7 +28,7 @@ import traceback from ansible import constants as C from ansible.errors import AnsibleError -from ansible.plugins.connection import ConnectionBase +from ansible.plugins.connection import ConnectionBase, BUFSIZE from ansible.module_utils.basic import is_executable from ansible.utils.unicode import to_bytes @@ -38,8 +38,6 @@ except ImportError: from ansible.utils.display import Display display = Display() -BUFSIZE = 65536 - class Connection(ConnectionBase): ''' Local chroot based connections ''' diff --git a/lib/ansible/plugins/connection/docker.py b/lib/ansible/plugins/connection/docker.py index b1c499ed72..13c6d8dc90 100644 --- a/lib/ansible/plugins/connection/docker.py +++ b/lib/ansible/plugins/connection/docker.py @@ -35,7 +35,7 @@ from distutils.version import LooseVersion import ansible.constants as C from ansible.errors import AnsibleError, AnsibleFileNotFound -from ansible.plugins.connection import ConnectionBase +from ansible.plugins.connection import ConnectionBase, BUFSIZE from ansible.utils.unicode import to_bytes try: @@ -44,8 +44,6 @@ except ImportError: from ansible.utils.display import Display display = Display() -BUFSIZE = 65536 - class Connection(ConnectionBase): ''' Local docker based connections ''' diff --git a/lib/ansible/plugins/connection/jail.py b/lib/ansible/plugins/connection/jail.py index d44213f439..f5cd6d2ef1 100644 --- a/lib/ansible/plugins/connection/jail.py +++ b/lib/ansible/plugins/connection/jail.py @@ -29,7 +29,7 @@ import traceback from ansible import constants as C from ansible.errors import AnsibleError -from ansible.plugins.connection import ConnectionBase +from ansible.plugins.connection import ConnectionBase, BUFSIZE from ansible.utils.unicode import to_bytes try: @@ -38,8 +38,6 @@ except ImportError: from ansible.utils.display import Display display = Display() -BUFSIZE = 65536 - class Connection(ConnectionBase): ''' Local BSD Jail based connections ''' diff --git a/lib/ansible/plugins/connection/libvirt_lxc.py b/lib/ansible/plugins/connection/libvirt_lxc.py index 9c4d6eac27..2b92e9c9dc 100644 --- a/lib/ansible/plugins/connection/libvirt_lxc.py +++ b/lib/ansible/plugins/connection/libvirt_lxc.py @@ -29,7 +29,7 @@ import traceback from ansible import constants as C from ansible.errors import AnsibleError -from ansible.plugins.connection import ConnectionBase +from ansible.plugins.connection import ConnectionBase, BUFSIZE from ansible.utils.unicode import to_bytes try: @@ -38,8 +38,6 @@ except ImportError: from ansible.utils.display import Display display = Display() -BUFSIZE = 65536 - class Connection(ConnectionBase): ''' Local lxc based connections ''' diff --git a/lib/ansible/plugins/connection/zone.py b/lib/ansible/plugins/connection/zone.py index b65c80b73f..2bd49a5249 100644 --- a/lib/ansible/plugins/connection/zone.py +++ b/lib/ansible/plugins/connection/zone.py @@ -30,7 +30,7 @@ import traceback from ansible import constants as C from ansible.errors import AnsibleError -from ansible.plugins.connection import ConnectionBase +from ansible.plugins.connection import ConnectionBase, BUFSIZE from ansible.utils import to_bytes try: @@ -39,8 +39,6 @@ except ImportError: from ansible.utils.display import Display display = Display() -BUFSIZE = 65536 - class Connection(ConnectionBase): ''' Local zone based connections '''