mirror of
https://github.com/ansible-collections/community.docker.git
synced 2025-12-15 19:42:06 +00:00
Python code modernization, 3/n (#1157)
* Remove __metaclass__ = type. for i in $(grep -REl '__metaclass__ = type' plugins/ tests/); do sed -e '/^__metaclass__ = type/d' -i $i; done * Remove super arguments, and stop inheriting from object.
This commit is contained in:
parent
741c318b1d
commit
e8ec22d3b1
@ -406,7 +406,6 @@ disable=raw-checker-failed,
|
|||||||
redefined-outer-name, # needed for test fixtures
|
redefined-outer-name, # needed for test fixtures
|
||||||
simplifiable-if-expression,
|
simplifiable-if-expression,
|
||||||
subprocess-popen-preexec-fn,
|
subprocess-popen-preexec-fn,
|
||||||
super-with-arguments,
|
|
||||||
unexpected-keyword-arg,
|
unexpected-keyword-arg,
|
||||||
unnecessary-dunder-call,
|
unnecessary-dunder-call,
|
||||||
unnecessary-pass,
|
unnecessary-pass,
|
||||||
@ -415,7 +414,6 @@ disable=raw-checker-failed,
|
|||||||
unused-variable,
|
unused-variable,
|
||||||
use-dict-literal,
|
use-dict-literal,
|
||||||
use-list-literal,
|
use-list-literal,
|
||||||
useless-object-inheritance,
|
|
||||||
# Cannot remove yet due to inadequacy of rules
|
# Cannot remove yet due to inadequacy of rules
|
||||||
inconsistent-return-statements, # doesn't notice that fail_json() does not return
|
inconsistent-return-statements, # doesn't notice that fail_json() does not return
|
||||||
|
|
||||||
|
|||||||
@ -22,7 +22,7 @@ class ActionModule(ActionBase):
|
|||||||
self._supports_check_mode = True
|
self._supports_check_mode = True
|
||||||
self._supports_async = True
|
self._supports_async = True
|
||||||
|
|
||||||
result = super(ActionModule, self).run(tmp, task_vars)
|
result = super().run(tmp, task_vars)
|
||||||
del tmp # tmp no longer has any effect
|
del tmp # tmp no longer has any effect
|
||||||
|
|
||||||
self._task.args["_max_file_size_for_diff"] = C.MAX_FILE_SIZE_FOR_DIFF
|
self._task.args["_max_file_size_for_diff"] = C.MAX_FILE_SIZE_FOR_DIFF
|
||||||
|
|||||||
@ -140,7 +140,7 @@ class Connection(ConnectionBase):
|
|||||||
has_pipelining = True
|
has_pipelining = True
|
||||||
|
|
||||||
def __init__(self, play_context, new_stdin, *args, **kwargs):
|
def __init__(self, play_context, new_stdin, *args, **kwargs):
|
||||||
super(Connection, self).__init__(play_context, new_stdin, *args, **kwargs)
|
super().__init__(play_context, new_stdin, *args, **kwargs)
|
||||||
|
|
||||||
# Note: docker supports running as non-root in some configurations.
|
# Note: docker supports running as non-root in some configurations.
|
||||||
# (For instance, setting the UNIX socket file to be readable and
|
# (For instance, setting the UNIX socket file to be readable and
|
||||||
@ -365,7 +365,7 @@ class Connection(ConnectionBase):
|
|||||||
|
|
||||||
def _connect(self, port=None):
|
def _connect(self, port=None):
|
||||||
"""Connect to the container. Nothing to do"""
|
"""Connect to the container. Nothing to do"""
|
||||||
super(Connection, self)._connect()
|
super()._connect()
|
||||||
if not self._connected:
|
if not self._connected:
|
||||||
self._set_conn_data()
|
self._set_conn_data()
|
||||||
actual_user = self._get_actual_user()
|
actual_user = self._get_actual_user()
|
||||||
@ -380,7 +380,7 @@ class Connection(ConnectionBase):
|
|||||||
|
|
||||||
self._set_conn_data()
|
self._set_conn_data()
|
||||||
|
|
||||||
super(Connection, self).exec_command(cmd, in_data=in_data, sudoable=sudoable)
|
super().exec_command(cmd, in_data=in_data, sudoable=sudoable)
|
||||||
|
|
||||||
local_cmd = self._build_exec_cmd([self._play_context.executable, "-c", cmd])
|
local_cmd = self._build_exec_cmd([self._play_context.executable, "-c", cmd])
|
||||||
|
|
||||||
@ -490,7 +490,7 @@ class Connection(ConnectionBase):
|
|||||||
def put_file(self, in_path, out_path):
|
def put_file(self, in_path, out_path):
|
||||||
"""Transfer a file from local to docker container"""
|
"""Transfer a file from local to docker container"""
|
||||||
self._set_conn_data()
|
self._set_conn_data()
|
||||||
super(Connection, self).put_file(in_path, out_path)
|
super().put_file(in_path, out_path)
|
||||||
display.vvv(f"PUT {in_path} TO {out_path}", host=self.get_option("remote_addr"))
|
display.vvv(f"PUT {in_path} TO {out_path}", host=self.get_option("remote_addr"))
|
||||||
|
|
||||||
out_path = self._prefix_login_path(out_path)
|
out_path = self._prefix_login_path(out_path)
|
||||||
@ -535,7 +535,7 @@ class Connection(ConnectionBase):
|
|||||||
def fetch_file(self, in_path, out_path):
|
def fetch_file(self, in_path, out_path):
|
||||||
"""Fetch a file from container to local."""
|
"""Fetch a file from container to local."""
|
||||||
self._set_conn_data()
|
self._set_conn_data()
|
||||||
super(Connection, self).fetch_file(in_path, out_path)
|
super().fetch_file(in_path, out_path)
|
||||||
display.vvv(
|
display.vvv(
|
||||||
f"FETCH {in_path} TO {out_path}", host=self.get_option("remote_addr")
|
f"FETCH {in_path} TO {out_path}", host=self.get_option("remote_addr")
|
||||||
)
|
)
|
||||||
@ -602,7 +602,7 @@ class Connection(ConnectionBase):
|
|||||||
|
|
||||||
def close(self):
|
def close(self):
|
||||||
"""Terminate the connection. Nothing to do for Docker"""
|
"""Terminate the connection. Nothing to do for Docker"""
|
||||||
super(Connection, self).close()
|
super().close()
|
||||||
self._connected = False
|
self._connected = False
|
||||||
|
|
||||||
def reset(self):
|
def reset(self):
|
||||||
|
|||||||
@ -180,7 +180,7 @@ class Connection(ConnectionBase):
|
|||||||
)
|
)
|
||||||
|
|
||||||
def __init__(self, play_context, new_stdin, *args, **kwargs):
|
def __init__(self, play_context, new_stdin, *args, **kwargs):
|
||||||
super(Connection, self).__init__(play_context, new_stdin, *args, **kwargs)
|
super().__init__(play_context, new_stdin, *args, **kwargs)
|
||||||
|
|
||||||
self.client = None
|
self.client = None
|
||||||
self.ids = dict()
|
self.ids = dict()
|
||||||
@ -193,7 +193,7 @@ class Connection(ConnectionBase):
|
|||||||
|
|
||||||
def _connect(self, port=None):
|
def _connect(self, port=None):
|
||||||
"""Connect to the container. Nothing to do"""
|
"""Connect to the container. Nothing to do"""
|
||||||
super(Connection, self)._connect()
|
super()._connect()
|
||||||
if not self._connected:
|
if not self._connected:
|
||||||
self.actual_user = self.get_option("remote_user")
|
self.actual_user = self.get_option("remote_user")
|
||||||
display.vvv(
|
display.vvv(
|
||||||
@ -224,7 +224,7 @@ class Connection(ConnectionBase):
|
|||||||
def exec_command(self, cmd, in_data=None, sudoable=False):
|
def exec_command(self, cmd, in_data=None, sudoable=False):
|
||||||
"""Run a command on the docker host"""
|
"""Run a command on the docker host"""
|
||||||
|
|
||||||
super(Connection, self).exec_command(cmd, in_data=in_data, sudoable=sudoable)
|
super().exec_command(cmd, in_data=in_data, sudoable=sudoable)
|
||||||
|
|
||||||
command = [self._play_context.executable, "-c", to_text(cmd)]
|
command = [self._play_context.executable, "-c", to_text(cmd)]
|
||||||
|
|
||||||
@ -376,7 +376,7 @@ class Connection(ConnectionBase):
|
|||||||
|
|
||||||
def put_file(self, in_path, out_path):
|
def put_file(self, in_path, out_path):
|
||||||
"""Transfer a file from local to docker container"""
|
"""Transfer a file from local to docker container"""
|
||||||
super(Connection, self).put_file(in_path, out_path)
|
super().put_file(in_path, out_path)
|
||||||
display.vvv(f"PUT {in_path} TO {out_path}", host=self.get_option("remote_addr"))
|
display.vvv(f"PUT {in_path} TO {out_path}", host=self.get_option("remote_addr"))
|
||||||
|
|
||||||
out_path = self._prefix_login_path(out_path)
|
out_path = self._prefix_login_path(out_path)
|
||||||
@ -418,7 +418,7 @@ class Connection(ConnectionBase):
|
|||||||
|
|
||||||
def fetch_file(self, in_path, out_path):
|
def fetch_file(self, in_path, out_path):
|
||||||
"""Fetch a file from container to local."""
|
"""Fetch a file from container to local."""
|
||||||
super(Connection, self).fetch_file(in_path, out_path)
|
super().fetch_file(in_path, out_path)
|
||||||
display.vvv(
|
display.vvv(
|
||||||
f"FETCH {in_path} TO {out_path}", host=self.get_option("remote_addr")
|
f"FETCH {in_path} TO {out_path}", host=self.get_option("remote_addr")
|
||||||
)
|
)
|
||||||
@ -446,7 +446,7 @@ class Connection(ConnectionBase):
|
|||||||
|
|
||||||
def close(self):
|
def close(self):
|
||||||
"""Terminate the connection. Nothing to do for Docker"""
|
"""Terminate the connection. Nothing to do for Docker"""
|
||||||
super(Connection, self).close()
|
super().close()
|
||||||
self._connected = False
|
self._connected = False
|
||||||
|
|
||||||
def reset(self):
|
def reset(self):
|
||||||
|
|||||||
@ -64,7 +64,7 @@ class Connection(ConnectionBase):
|
|||||||
has_pipelining = False
|
has_pipelining = False
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
super(Connection, self).__init__(*args, **kwargs)
|
super().__init__(*args, **kwargs)
|
||||||
self.cwd = None
|
self.cwd = None
|
||||||
|
|
||||||
def _connect(self):
|
def _connect(self):
|
||||||
@ -83,7 +83,7 @@ class Connection(ConnectionBase):
|
|||||||
return self
|
return self
|
||||||
|
|
||||||
def exec_command(self, cmd, in_data=None, sudoable=True):
|
def exec_command(self, cmd, in_data=None, sudoable=True):
|
||||||
super(Connection, self).exec_command(cmd, in_data=in_data, sudoable=sudoable)
|
super().exec_command(cmd, in_data=in_data, sudoable=sudoable)
|
||||||
|
|
||||||
display.debug("in nsenter.exec_command()")
|
display.debug("in nsenter.exec_command()")
|
||||||
|
|
||||||
@ -232,7 +232,7 @@ class Connection(ConnectionBase):
|
|||||||
return (p.returncode, stdout, stderr)
|
return (p.returncode, stdout, stderr)
|
||||||
|
|
||||||
def put_file(self, in_path, out_path):
|
def put_file(self, in_path, out_path):
|
||||||
super(Connection, self).put_file(in_path, out_path)
|
super().put_file(in_path, out_path)
|
||||||
|
|
||||||
in_path = unfrackpath(in_path, basedir=self.cwd)
|
in_path = unfrackpath(in_path, basedir=self.cwd)
|
||||||
out_path = unfrackpath(out_path, basedir=self.cwd)
|
out_path = unfrackpath(out_path, basedir=self.cwd)
|
||||||
@ -248,7 +248,7 @@ class Connection(ConnectionBase):
|
|||||||
raise AnsibleError(f"failed to transfer file to {out_path}: {e}")
|
raise AnsibleError(f"failed to transfer file to {out_path}: {e}")
|
||||||
|
|
||||||
def fetch_file(self, in_path, out_path):
|
def fetch_file(self, in_path, out_path):
|
||||||
super(Connection, self).fetch_file(in_path, out_path)
|
super().fetch_file(in_path, out_path)
|
||||||
|
|
||||||
in_path = unfrackpath(in_path, basedir=self.cwd)
|
in_path = unfrackpath(in_path, basedir=self.cwd)
|
||||||
out_path = unfrackpath(out_path, basedir=self.cwd)
|
out_path = unfrackpath(out_path, basedir=self.cwd)
|
||||||
|
|||||||
@ -8,7 +8,7 @@
|
|||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
|
|
||||||
class ModuleDocFragment(object):
|
class ModuleDocFragment:
|
||||||
|
|
||||||
# Standard documentation fragment
|
# Standard documentation fragment
|
||||||
DOCUMENTATION = r"""
|
DOCUMENTATION = r"""
|
||||||
|
|||||||
@ -8,7 +8,7 @@
|
|||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
|
|
||||||
class ModuleDocFragment(object):
|
class ModuleDocFragment:
|
||||||
|
|
||||||
# Docker doc fragment
|
# Docker doc fragment
|
||||||
DOCUMENTATION = r"""
|
DOCUMENTATION = r"""
|
||||||
|
|||||||
@ -8,7 +8,7 @@
|
|||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
|
|
||||||
class ModuleDocFragment(object):
|
class ModuleDocFragment:
|
||||||
|
|
||||||
# Docker doc fragment
|
# Docker doc fragment
|
||||||
DOCUMENTATION = r"""
|
DOCUMENTATION = r"""
|
||||||
|
|||||||
@ -386,7 +386,7 @@ class InventoryModule(BaseInventoryPlugin, Constructable):
|
|||||||
|
|
||||||
def verify_file(self, path):
|
def verify_file(self, path):
|
||||||
"""Return the possibly of a file being consumable by this plugin."""
|
"""Return the possibly of a file being consumable by this plugin."""
|
||||||
return super(InventoryModule, self).verify_file(path) and path.endswith(
|
return super().verify_file(path) and path.endswith(
|
||||||
("docker.yaml", "docker.yml")
|
("docker.yaml", "docker.yml")
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -394,7 +394,7 @@ class InventoryModule(BaseInventoryPlugin, Constructable):
|
|||||||
return AnsibleDockerClient(self, min_docker_api_version=MIN_DOCKER_API)
|
return AnsibleDockerClient(self, min_docker_api_version=MIN_DOCKER_API)
|
||||||
|
|
||||||
def parse(self, inventory, loader, path, cache=True):
|
def parse(self, inventory, loader, path, cache=True):
|
||||||
super(InventoryModule, self).parse(inventory, loader, path, cache)
|
super().parse(inventory, loader, path, cache)
|
||||||
self._read_config_data(path)
|
self._read_config_data(path)
|
||||||
client = self._create_client()
|
client = self._create_client()
|
||||||
try:
|
try:
|
||||||
|
|||||||
@ -326,11 +326,11 @@ class InventoryModule(BaseInventoryPlugin, Constructable, Cacheable):
|
|||||||
|
|
||||||
def verify_file(self, path):
|
def verify_file(self, path):
|
||||||
"""Return the possibility of a file being consumable by this plugin."""
|
"""Return the possibility of a file being consumable by this plugin."""
|
||||||
return super(InventoryModule, self).verify_file(path) and path.endswith(
|
return super().verify_file(path) and path.endswith(
|
||||||
("docker_machine.yaml", "docker_machine.yml")
|
("docker_machine.yaml", "docker_machine.yml")
|
||||||
)
|
)
|
||||||
|
|
||||||
def parse(self, inventory, loader, path, cache=True):
|
def parse(self, inventory, loader, path, cache=True):
|
||||||
super(InventoryModule, self).parse(inventory, loader, path, cache)
|
super().parse(inventory, loader, path, cache)
|
||||||
self._read_config_data(path)
|
self._read_config_data(path)
|
||||||
self._populate()
|
self._populate()
|
||||||
|
|||||||
@ -308,7 +308,7 @@ class InventoryModule(BaseInventoryPlugin, Constructable):
|
|||||||
|
|
||||||
def verify_file(self, path):
|
def verify_file(self, path):
|
||||||
"""Return the possibly of a file being consumable by this plugin."""
|
"""Return the possibly of a file being consumable by this plugin."""
|
||||||
return super(InventoryModule, self).verify_file(path) and path.endswith(
|
return super().verify_file(path) and path.endswith(
|
||||||
("docker_swarm.yaml", "docker_swarm.yml")
|
("docker_swarm.yaml", "docker_swarm.yml")
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -318,6 +318,6 @@ class InventoryModule(BaseInventoryPlugin, Constructable):
|
|||||||
"The Docker swarm dynamic inventory plugin requires the Docker SDK for Python: "
|
"The Docker swarm dynamic inventory plugin requires the Docker SDK for Python: "
|
||||||
"https://github.com/docker/docker-py."
|
"https://github.com/docker/docker-py."
|
||||||
)
|
)
|
||||||
super(InventoryModule, self).parse(inventory, loader, path, cache)
|
super().parse(inventory, loader, path, cache)
|
||||||
self._read_config_data(path)
|
self._read_config_data(path)
|
||||||
self._populate()
|
self._populate()
|
||||||
|
|||||||
@ -30,10 +30,10 @@ try:
|
|||||||
except ImportError:
|
except ImportError:
|
||||||
REQUESTS_IMPORT_ERROR = traceback.format_exc()
|
REQUESTS_IMPORT_ERROR = traceback.format_exc()
|
||||||
|
|
||||||
class Session(object):
|
class Session:
|
||||||
__attrs__ = []
|
__attrs__ = []
|
||||||
|
|
||||||
class HTTPAdapter(object):
|
class HTTPAdapter:
|
||||||
__attrs__ = []
|
__attrs__ = []
|
||||||
|
|
||||||
class HTTPError(Exception):
|
class HTTPError(Exception):
|
||||||
@ -57,13 +57,13 @@ except ImportError:
|
|||||||
except ImportError:
|
except ImportError:
|
||||||
URLLIB3_IMPORT_ERROR = traceback.format_exc()
|
URLLIB3_IMPORT_ERROR = traceback.format_exc()
|
||||||
|
|
||||||
class _HTTPConnectionPool(object):
|
class _HTTPConnectionPool:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
class _HTTPConnection(object):
|
class _HTTPConnection:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
class FakeURLLIB3(object):
|
class FakeURLLIB3:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self._collections = self
|
self._collections = self
|
||||||
self.poolmanager = self
|
self.poolmanager = self
|
||||||
@ -75,7 +75,7 @@ except ImportError:
|
|||||||
self.match_hostname = object()
|
self.match_hostname = object()
|
||||||
self.HTTPConnectionPool = _HTTPConnectionPool
|
self.HTTPConnectionPool = _HTTPConnectionPool
|
||||||
|
|
||||||
class FakeURLLIB3Connection(object):
|
class FakeURLLIB3Connection:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.HTTPConnection = _HTTPConnection
|
self.HTTPConnection = _HTTPConnection
|
||||||
|
|
||||||
|
|||||||
@ -115,7 +115,7 @@ class APIClient(_Session, DaemonApiMixin):
|
|||||||
use_ssh_client=False,
|
use_ssh_client=False,
|
||||||
max_pool_size=DEFAULT_MAX_POOL_SIZE,
|
max_pool_size=DEFAULT_MAX_POOL_SIZE,
|
||||||
):
|
):
|
||||||
super(APIClient, self).__init__()
|
super().__init__()
|
||||||
|
|
||||||
fail_on_missing_imports()
|
fail_on_missing_imports()
|
||||||
|
|
||||||
@ -493,7 +493,7 @@ class APIClient(_Session, DaemonApiMixin):
|
|||||||
|
|
||||||
def get_adapter(self, url):
|
def get_adapter(self, url):
|
||||||
try:
|
try:
|
||||||
return super(APIClient, self).get_adapter(url)
|
return super().get_adapter(url)
|
||||||
except _InvalidSchema as e:
|
except _InvalidSchema as e:
|
||||||
if self._custom_adapter:
|
if self._custom_adapter:
|
||||||
return self._custom_adapter
|
return self._custom_adapter
|
||||||
|
|||||||
@ -17,7 +17,7 @@ from .. import auth
|
|||||||
from ..utils.decorators import minimum_version
|
from ..utils.decorators import minimum_version
|
||||||
|
|
||||||
|
|
||||||
class DaemonApiMixin(object):
|
class DaemonApiMixin:
|
||||||
@minimum_version("1.25")
|
@minimum_version("1.25")
|
||||||
def df(self):
|
def df(self):
|
||||||
"""
|
"""
|
||||||
|
|||||||
@ -33,7 +33,7 @@ def create_default_context():
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class ContextAPI(object):
|
class ContextAPI:
|
||||||
"""Context API.
|
"""Context API.
|
||||||
Contains methods for context management:
|
Contains methods for context management:
|
||||||
create, list, remove, get, inspect.
|
create, list, remove, get, inspect.
|
||||||
|
|||||||
@ -28,7 +28,7 @@ from .config import (
|
|||||||
IN_MEMORY = "IN MEMORY"
|
IN_MEMORY = "IN MEMORY"
|
||||||
|
|
||||||
|
|
||||||
class Context(object):
|
class Context:
|
||||||
"""A context."""
|
"""A context."""
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
|
|||||||
@ -19,7 +19,7 @@ from . import constants, errors
|
|||||||
from .utils import create_environment_dict, find_executable
|
from .utils import create_environment_dict, find_executable
|
||||||
|
|
||||||
|
|
||||||
class Store(object):
|
class Store:
|
||||||
def __init__(self, program, environment=None):
|
def __init__(self, program, environment=None):
|
||||||
"""Create a store object that acts as an interface to
|
"""Create a store object that acts as an interface to
|
||||||
perform the basic operations for storing, retrieving
|
perform the basic operations for storing, retrieving
|
||||||
|
|||||||
@ -55,12 +55,12 @@ class APIError(_HTTPError, DockerException):
|
|||||||
def __init__(self, message, response=None, explanation=None):
|
def __init__(self, message, response=None, explanation=None):
|
||||||
# requests 1.2 supports response as a keyword argument, but
|
# requests 1.2 supports response as a keyword argument, but
|
||||||
# requests 1.1 does not
|
# requests 1.1 does not
|
||||||
super(APIError, self).__init__(message)
|
super().__init__(message)
|
||||||
self.response = response
|
self.response = response
|
||||||
self.explanation = explanation
|
self.explanation = explanation
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
message = super(APIError, self).__str__()
|
message = super().__str__()
|
||||||
|
|
||||||
if self.is_client_error():
|
if self.is_client_error():
|
||||||
message = f"{self.response.status_code} Client Error for {self.response.url}: {self.response.reason}"
|
message = f"{self.response.status_code} Client Error for {self.response.url}: {self.response.reason}"
|
||||||
@ -152,7 +152,7 @@ class ContainerError(DockerException):
|
|||||||
err = f": {stderr}" if stderr is not None else ""
|
err = f": {stderr}" if stderr is not None else ""
|
||||||
msg = f"Command '{command}' in image '{image}' returned non-zero exit status {exit_status}{err}"
|
msg = f"Command '{command}' in image '{image}' returned non-zero exit status {exit_status}{err}"
|
||||||
|
|
||||||
super(ContainerError, self).__init__(msg)
|
super().__init__(msg)
|
||||||
|
|
||||||
|
|
||||||
class StreamParseError(RuntimeError):
|
class StreamParseError(RuntimeError):
|
||||||
@ -162,7 +162,7 @@ class StreamParseError(RuntimeError):
|
|||||||
|
|
||||||
class BuildError(DockerException):
|
class BuildError(DockerException):
|
||||||
def __init__(self, reason, build_log):
|
def __init__(self, reason, build_log):
|
||||||
super(BuildError, self).__init__(reason)
|
super().__init__(reason)
|
||||||
self.msg = reason
|
self.msg = reason
|
||||||
self.build_log = build_log
|
self.build_log = build_log
|
||||||
|
|
||||||
|
|||||||
@ -18,7 +18,7 @@ from . import errors
|
|||||||
from .transport.ssladapter import SSLHTTPAdapter
|
from .transport.ssladapter import SSLHTTPAdapter
|
||||||
|
|
||||||
|
|
||||||
class TLSConfig(object):
|
class TLSConfig:
|
||||||
"""
|
"""
|
||||||
TLS configuration.
|
TLS configuration.
|
||||||
|
|
||||||
|
|||||||
@ -16,7 +16,7 @@ from .._import_helper import HTTPAdapter as _HTTPAdapter
|
|||||||
|
|
||||||
class BaseHTTPAdapter(_HTTPAdapter):
|
class BaseHTTPAdapter(_HTTPAdapter):
|
||||||
def close(self):
|
def close(self):
|
||||||
super(BaseHTTPAdapter, self).close()
|
super().close()
|
||||||
if hasattr(self, "pools"):
|
if hasattr(self, "pools"):
|
||||||
self.pools.clear()
|
self.pools.clear()
|
||||||
|
|
||||||
|
|||||||
@ -22,9 +22,9 @@ from .npipesocket import NpipeSocket
|
|||||||
RecentlyUsedContainer = urllib3._collections.RecentlyUsedContainer
|
RecentlyUsedContainer = urllib3._collections.RecentlyUsedContainer
|
||||||
|
|
||||||
|
|
||||||
class NpipeHTTPConnection(urllib3_connection.HTTPConnection, object):
|
class NpipeHTTPConnection(urllib3_connection.HTTPConnection):
|
||||||
def __init__(self, npipe_path, timeout=60):
|
def __init__(self, npipe_path, timeout=60):
|
||||||
super(NpipeHTTPConnection, self).__init__("localhost", timeout=timeout)
|
super().__init__("localhost", timeout=timeout)
|
||||||
self.npipe_path = npipe_path
|
self.npipe_path = npipe_path
|
||||||
self.timeout = timeout
|
self.timeout = timeout
|
||||||
|
|
||||||
@ -37,9 +37,7 @@ class NpipeHTTPConnection(urllib3_connection.HTTPConnection, object):
|
|||||||
|
|
||||||
class NpipeHTTPConnectionPool(urllib3.connectionpool.HTTPConnectionPool):
|
class NpipeHTTPConnectionPool(urllib3.connectionpool.HTTPConnectionPool):
|
||||||
def __init__(self, npipe_path, timeout=60, maxsize=10):
|
def __init__(self, npipe_path, timeout=60, maxsize=10):
|
||||||
super(NpipeHTTPConnectionPool, self).__init__(
|
super().__init__("localhost", timeout=timeout, maxsize=maxsize)
|
||||||
"localhost", timeout=timeout, maxsize=maxsize
|
|
||||||
)
|
|
||||||
self.npipe_path = npipe_path
|
self.npipe_path = npipe_path
|
||||||
self.timeout = timeout
|
self.timeout = timeout
|
||||||
|
|
||||||
@ -90,7 +88,7 @@ class NpipeHTTPAdapter(BaseHTTPAdapter):
|
|||||||
self.pools = RecentlyUsedContainer(
|
self.pools = RecentlyUsedContainer(
|
||||||
pool_connections, dispose_func=lambda p: p.close()
|
pool_connections, dispose_func=lambda p: p.close()
|
||||||
)
|
)
|
||||||
super(NpipeHTTPAdapter, self).__init__()
|
super().__init__()
|
||||||
|
|
||||||
def get_connection(self, url, proxies=None):
|
def get_connection(self, url, proxies=None):
|
||||||
with self.pools.lock:
|
with self.pools.lock:
|
||||||
|
|||||||
@ -45,7 +45,7 @@ def check_closed(f):
|
|||||||
return wrapped
|
return wrapped
|
||||||
|
|
||||||
|
|
||||||
class NpipeSocket(object):
|
class NpipeSocket:
|
||||||
"""Partial implementation of the socket API over windows named pipes.
|
"""Partial implementation of the socket API over windows named pipes.
|
||||||
This implementation is only designed to be used as a client socket,
|
This implementation is only designed to be used as a client socket,
|
||||||
and server-specific methods (bind, listen, accept...) are not
|
and server-specific methods (bind, listen, accept...) are not
|
||||||
@ -227,7 +227,7 @@ class NpipeFileIOBase(io.RawIOBase):
|
|||||||
self.sock = npipe_socket
|
self.sock = npipe_socket
|
||||||
|
|
||||||
def close(self):
|
def close(self):
|
||||||
super(NpipeFileIOBase, self).close()
|
super().close()
|
||||||
self.sock = None
|
self.sock = None
|
||||||
|
|
||||||
def fileno(self):
|
def fileno(self):
|
||||||
|
|||||||
@ -37,7 +37,7 @@ RecentlyUsedContainer = urllib3._collections.RecentlyUsedContainer
|
|||||||
|
|
||||||
class SSHSocket(socket.socket):
|
class SSHSocket(socket.socket):
|
||||||
def __init__(self, host):
|
def __init__(self, host):
|
||||||
super(SSHSocket, self).__init__(socket.AF_INET, socket.SOCK_STREAM)
|
super().__init__(socket.AF_INET, socket.SOCK_STREAM)
|
||||||
self.host = host
|
self.host = host
|
||||||
self.port = None
|
self.port = None
|
||||||
self.user = None
|
self.user = None
|
||||||
@ -117,9 +117,9 @@ class SSHSocket(socket.socket):
|
|||||||
self.proc.terminate()
|
self.proc.terminate()
|
||||||
|
|
||||||
|
|
||||||
class SSHConnection(urllib3_connection.HTTPConnection, object):
|
class SSHConnection(urllib3_connection.HTTPConnection):
|
||||||
def __init__(self, ssh_transport=None, timeout=60, host=None):
|
def __init__(self, ssh_transport=None, timeout=60, host=None):
|
||||||
super(SSHConnection, self).__init__("localhost", timeout=timeout)
|
super().__init__("localhost", timeout=timeout)
|
||||||
self.ssh_transport = ssh_transport
|
self.ssh_transport = ssh_transport
|
||||||
self.timeout = timeout
|
self.timeout = timeout
|
||||||
self.ssh_host = host
|
self.ssh_host = host
|
||||||
@ -141,9 +141,7 @@ class SSHConnectionPool(urllib3.connectionpool.HTTPConnectionPool):
|
|||||||
scheme = "ssh"
|
scheme = "ssh"
|
||||||
|
|
||||||
def __init__(self, ssh_client=None, timeout=60, maxsize=10, host=None):
|
def __init__(self, ssh_client=None, timeout=60, maxsize=10, host=None):
|
||||||
super(SSHConnectionPool, self).__init__(
|
super().__init__("localhost", timeout=timeout, maxsize=maxsize)
|
||||||
"localhost", timeout=timeout, maxsize=maxsize
|
|
||||||
)
|
|
||||||
self.ssh_transport = None
|
self.ssh_transport = None
|
||||||
self.timeout = timeout
|
self.timeout = timeout
|
||||||
if ssh_client:
|
if ssh_client:
|
||||||
@ -207,7 +205,7 @@ class SSHHTTPAdapter(BaseHTTPAdapter):
|
|||||||
self.pools = RecentlyUsedContainer(
|
self.pools = RecentlyUsedContainer(
|
||||||
pool_connections, dispose_func=lambda p: p.close()
|
pool_connections, dispose_func=lambda p: p.close()
|
||||||
)
|
)
|
||||||
super(SSHHTTPAdapter, self).__init__()
|
super().__init__()
|
||||||
|
|
||||||
def _create_paramiko_client(self, base_url):
|
def _create_paramiko_client(self, base_url):
|
||||||
logging.getLogger("paramiko").setLevel(logging.WARNING)
|
logging.getLogger("paramiko").setLevel(logging.WARNING)
|
||||||
@ -272,6 +270,6 @@ class SSHHTTPAdapter(BaseHTTPAdapter):
|
|||||||
return pool
|
return pool
|
||||||
|
|
||||||
def close(self):
|
def close(self):
|
||||||
super(SSHHTTPAdapter, self).close()
|
super().close()
|
||||||
if self.ssh_client:
|
if self.ssh_client:
|
||||||
self.ssh_client.close()
|
self.ssh_client.close()
|
||||||
|
|||||||
@ -35,7 +35,7 @@ class SSLHTTPAdapter(BaseHTTPAdapter):
|
|||||||
def __init__(self, ssl_version=None, assert_hostname=None, **kwargs):
|
def __init__(self, ssl_version=None, assert_hostname=None, **kwargs):
|
||||||
self.ssl_version = ssl_version
|
self.ssl_version = ssl_version
|
||||||
self.assert_hostname = assert_hostname
|
self.assert_hostname = assert_hostname
|
||||||
super(SSLHTTPAdapter, self).__init__(**kwargs)
|
super().__init__(**kwargs)
|
||||||
|
|
||||||
def init_poolmanager(self, connections, maxsize, block=False):
|
def init_poolmanager(self, connections, maxsize, block=False):
|
||||||
kwargs = {
|
kwargs = {
|
||||||
@ -58,7 +58,7 @@ class SSLHTTPAdapter(BaseHTTPAdapter):
|
|||||||
|
|
||||||
But we still need to take care of when there is a proxy poolmanager
|
But we still need to take care of when there is a proxy poolmanager
|
||||||
"""
|
"""
|
||||||
conn = super(SSLHTTPAdapter, self).get_connection(*args, **kwargs)
|
conn = super().get_connection(*args, **kwargs)
|
||||||
if (
|
if (
|
||||||
self.assert_hostname is not None
|
self.assert_hostname is not None
|
||||||
and conn.assert_hostname != self.assert_hostname
|
and conn.assert_hostname != self.assert_hostname
|
||||||
|
|||||||
@ -21,10 +21,10 @@ from .basehttpadapter import BaseHTTPAdapter
|
|||||||
RecentlyUsedContainer = urllib3._collections.RecentlyUsedContainer
|
RecentlyUsedContainer = urllib3._collections.RecentlyUsedContainer
|
||||||
|
|
||||||
|
|
||||||
class UnixHTTPConnection(urllib3_connection.HTTPConnection, object):
|
class UnixHTTPConnection(urllib3_connection.HTTPConnection):
|
||||||
|
|
||||||
def __init__(self, base_url, unix_socket, timeout=60):
|
def __init__(self, base_url, unix_socket, timeout=60):
|
||||||
super(UnixHTTPConnection, self).__init__("localhost", timeout=timeout)
|
super().__init__("localhost", timeout=timeout)
|
||||||
self.base_url = base_url
|
self.base_url = base_url
|
||||||
self.unix_socket = unix_socket
|
self.unix_socket = unix_socket
|
||||||
self.timeout = timeout
|
self.timeout = timeout
|
||||||
@ -37,7 +37,7 @@ class UnixHTTPConnection(urllib3_connection.HTTPConnection, object):
|
|||||||
self.sock = sock
|
self.sock = sock
|
||||||
|
|
||||||
def putheader(self, header, *values):
|
def putheader(self, header, *values):
|
||||||
super(UnixHTTPConnection, self).putheader(header, *values)
|
super().putheader(header, *values)
|
||||||
if header == "Connection" and "Upgrade" in values:
|
if header == "Connection" and "Upgrade" in values:
|
||||||
self.disable_buffering = True
|
self.disable_buffering = True
|
||||||
|
|
||||||
@ -45,14 +45,12 @@ class UnixHTTPConnection(urllib3_connection.HTTPConnection, object):
|
|||||||
# FIXME: We may need to disable buffering on Py3,
|
# FIXME: We may need to disable buffering on Py3,
|
||||||
# but there's no clear way to do it at the moment. See:
|
# but there's no clear way to do it at the moment. See:
|
||||||
# https://github.com/docker/docker-py/issues/1799
|
# https://github.com/docker/docker-py/issues/1799
|
||||||
return super(UnixHTTPConnection, self).response_class(sock, *args, **kwargs)
|
return super().response_class(sock, *args, **kwargs)
|
||||||
|
|
||||||
|
|
||||||
class UnixHTTPConnectionPool(urllib3.connectionpool.HTTPConnectionPool):
|
class UnixHTTPConnectionPool(urllib3.connectionpool.HTTPConnectionPool):
|
||||||
def __init__(self, base_url, socket_path, timeout=60, maxsize=10):
|
def __init__(self, base_url, socket_path, timeout=60, maxsize=10):
|
||||||
super(UnixHTTPConnectionPool, self).__init__(
|
super().__init__("localhost", timeout=timeout, maxsize=maxsize)
|
||||||
"localhost", timeout=timeout, maxsize=maxsize
|
|
||||||
)
|
|
||||||
self.base_url = base_url
|
self.base_url = base_url
|
||||||
self.socket_path = socket_path
|
self.socket_path = socket_path
|
||||||
self.timeout = timeout
|
self.timeout = timeout
|
||||||
@ -86,7 +84,7 @@ class UnixHTTPAdapter(BaseHTTPAdapter):
|
|||||||
self.pools = RecentlyUsedContainer(
|
self.pools = RecentlyUsedContainer(
|
||||||
pool_connections, dispose_func=lambda p: p.close()
|
pool_connections, dispose_func=lambda p: p.close()
|
||||||
)
|
)
|
||||||
super(UnixHTTPAdapter, self).__init__()
|
super().__init__()
|
||||||
|
|
||||||
def get_connection(self, url, proxies=None):
|
def get_connection(self, url, proxies=None):
|
||||||
with self.pools.lock:
|
with self.pools.lock:
|
||||||
|
|||||||
@ -17,7 +17,7 @@ from .._import_helper import urllib3
|
|||||||
from ..errors import DockerException
|
from ..errors import DockerException
|
||||||
|
|
||||||
|
|
||||||
class CancellableStream(object):
|
class CancellableStream:
|
||||||
"""
|
"""
|
||||||
Stream wrapper for real-time events, logs, etc. from the server.
|
Stream wrapper for real-time events, logs, etc. from the server.
|
||||||
|
|
||||||
|
|||||||
@ -158,7 +158,7 @@ def walk(root, patterns, default=True):
|
|||||||
|
|
||||||
# Heavily based on
|
# Heavily based on
|
||||||
# https://github.com/moby/moby/blob/master/pkg/fileutils/fileutils.go
|
# https://github.com/moby/moby/blob/master/pkg/fileutils/fileutils.go
|
||||||
class PatternMatcher(object):
|
class PatternMatcher:
|
||||||
def __init__(self, patterns):
|
def __init__(self, patterns):
|
||||||
self.patterns = list(filter(lambda p: p.dirs, [Pattern(p) for p in patterns]))
|
self.patterns = list(filter(lambda p: p.dirs, [Pattern(p) for p in patterns]))
|
||||||
self.patterns.append(Pattern("!.dockerignore"))
|
self.patterns.append(Pattern("!.dockerignore"))
|
||||||
@ -216,7 +216,7 @@ class PatternMatcher(object):
|
|||||||
return rec_walk(root)
|
return rec_walk(root)
|
||||||
|
|
||||||
|
|
||||||
class Pattern(object):
|
class Pattern:
|
||||||
def __init__(self, pattern_str):
|
def __init__(self, pattern_str):
|
||||||
self.exclusion = False
|
self.exclusion = False
|
||||||
if pattern_str.startswith("!"):
|
if pattern_str.startswith("!"):
|
||||||
|
|||||||
@ -101,7 +101,7 @@ if not HAS_DOCKER_PY:
|
|||||||
|
|
||||||
# No Docker SDK for Python. Create a place holder client to allow
|
# No Docker SDK for Python. Create a place holder client to allow
|
||||||
# instantiation of AnsibleModule and proper error handing
|
# instantiation of AnsibleModule and proper error handing
|
||||||
class Client(object): # noqa: F811, pylint: disable=function-redefined
|
class Client: # noqa: F811, pylint: disable=function-redefined
|
||||||
def __init__(self, **kwargs):
|
def __init__(self, **kwargs):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@ -232,7 +232,7 @@ class AnsibleDockerClientBase(Client):
|
|||||||
)
|
)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
super(AnsibleDockerClientBase, self).__init__(**self._connect_params)
|
super().__init__(**self._connect_params)
|
||||||
self.docker_api_version_str = self.api_version
|
self.docker_api_version_str = self.api_version
|
||||||
except APIError as exc:
|
except APIError as exc:
|
||||||
self.fail(f"Docker API error: {exc}")
|
self.fail(f"Docker API error: {exc}")
|
||||||
@ -628,9 +628,7 @@ class AnsibleDockerClientBase(Client):
|
|||||||
),
|
),
|
||||||
get_json=True,
|
get_json=True,
|
||||||
)
|
)
|
||||||
return super(AnsibleDockerClientBase, self).inspect_distribution(
|
return super().inspect_distribution(image, **kwargs)
|
||||||
image, **kwargs
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
class AnsibleDockerClient(AnsibleDockerClientBase):
|
class AnsibleDockerClient(AnsibleDockerClientBase):
|
||||||
@ -684,7 +682,7 @@ class AnsibleDockerClient(AnsibleDockerClientBase):
|
|||||||
self.debug = self.module.params.get("debug")
|
self.debug = self.module.params.get("debug")
|
||||||
self.check_mode = self.module.check_mode
|
self.check_mode = self.module.check_mode
|
||||||
|
|
||||||
super(AnsibleDockerClient, self).__init__(
|
super().__init__(
|
||||||
min_docker_version=min_docker_version,
|
min_docker_version=min_docker_version,
|
||||||
min_docker_api_version=min_docker_api_version,
|
min_docker_api_version=min_docker_api_version,
|
||||||
)
|
)
|
||||||
|
|||||||
@ -119,7 +119,7 @@ class AnsibleDockerClientBase(Client):
|
|||||||
)
|
)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
super(AnsibleDockerClientBase, self).__init__(**self._connect_params)
|
super().__init__(**self._connect_params)
|
||||||
self.docker_api_version_str = self.api_version
|
self.docker_api_version_str = self.api_version
|
||||||
except MissingRequirementException as exc:
|
except MissingRequirementException as exc:
|
||||||
self.fail(
|
self.fail(
|
||||||
@ -592,9 +592,7 @@ class AnsibleDockerClient(AnsibleDockerClientBase):
|
|||||||
self.debug = self.module.params.get("debug")
|
self.debug = self.module.params.get("debug")
|
||||||
self.check_mode = self.module.check_mode
|
self.check_mode = self.module.check_mode
|
||||||
|
|
||||||
super(AnsibleDockerClient, self).__init__(
|
super().__init__(min_docker_api_version=min_docker_api_version)
|
||||||
min_docker_api_version=min_docker_api_version
|
|
||||||
)
|
|
||||||
|
|
||||||
if option_minimal_versions is not None:
|
if option_minimal_versions is not None:
|
||||||
self._get_minimal_versions(
|
self._get_minimal_versions(
|
||||||
|
|||||||
@ -61,7 +61,7 @@ class DockerException(Exception):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class AnsibleDockerClientBase(object):
|
class AnsibleDockerClientBase:
|
||||||
def __init__(
|
def __init__(
|
||||||
self, common_args, min_docker_api_version=None, needs_api_version=True
|
self, common_args, min_docker_api_version=None, needs_api_version=True
|
||||||
):
|
):
|
||||||
@ -357,7 +357,7 @@ class AnsibleModuleDockerClient(AnsibleDockerClientBase):
|
|||||||
self.diff = self.module._diff
|
self.diff = self.module._diff
|
||||||
|
|
||||||
common_args = dict((k, self.module.params[k]) for k in DOCKER_COMMON_ARGS)
|
common_args = dict((k, self.module.params[k]) for k in DOCKER_COMMON_ARGS)
|
||||||
super(AnsibleModuleDockerClient, self).__init__(
|
super().__init__(
|
||||||
common_args,
|
common_args,
|
||||||
min_docker_api_version=min_docker_api_version,
|
min_docker_api_version=min_docker_api_version,
|
||||||
needs_api_version=needs_api_version,
|
needs_api_version=needs_api_version,
|
||||||
|
|||||||
@ -132,7 +132,7 @@ DOCKER_PULL_PROGRESS_WORKING = frozenset(
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class ResourceType(object):
|
class ResourceType:
|
||||||
UNKNOWN = "unknown"
|
UNKNOWN = "unknown"
|
||||||
NETWORK = "network"
|
NETWORK = "network"
|
||||||
IMAGE = "image"
|
IMAGE = "image"
|
||||||
@ -724,7 +724,7 @@ def combine_text_output(*outputs):
|
|||||||
|
|
||||||
class BaseComposeManager(DockerBaseClass):
|
class BaseComposeManager(DockerBaseClass):
|
||||||
def __init__(self, client, min_version=MINIMUM_COMPOSE_VERSION):
|
def __init__(self, client, min_version=MINIMUM_COMPOSE_VERSION):
|
||||||
super(BaseComposeManager, self).__init__()
|
super().__init__()
|
||||||
self.client = client
|
self.client = client
|
||||||
self.check_mode = self.client.check_mode
|
self.check_mode = self.client.check_mode
|
||||||
self.cleanup_dirs = set()
|
self.cleanup_dirs = set()
|
||||||
|
|||||||
@ -12,7 +12,7 @@ import os
|
|||||||
import tarfile
|
import tarfile
|
||||||
|
|
||||||
|
|
||||||
class ImageArchiveManifestSummary(object):
|
class ImageArchiveManifestSummary:
|
||||||
"""
|
"""
|
||||||
Represents data extracted from a manifest.json found in the tar archive output of the
|
Represents data extracted from a manifest.json found in the tar archive output of the
|
||||||
"docker image save some:tag > some.tar" command.
|
"docker image save some:tag > some.tar" command.
|
||||||
|
|||||||
@ -22,7 +22,7 @@ class InvalidLogFmt(Exception):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class _Mode(object):
|
class _Mode:
|
||||||
GARBAGE = 0
|
GARBAGE = 0
|
||||||
KEY = 1
|
KEY = 1
|
||||||
EQUAL = 2
|
EQUAL = 2
|
||||||
@ -72,7 +72,7 @@ def _is_ident(cur):
|
|||||||
return cur > " " and cur not in ('"', "=")
|
return cur > " " and cur not in ('"', "=")
|
||||||
|
|
||||||
|
|
||||||
class _Parser(object):
|
class _Parser:
|
||||||
def __init__(self, line):
|
def __init__(self, line):
|
||||||
self.line = line
|
self.line = line
|
||||||
self.index = 0
|
self.index = 0
|
||||||
|
|||||||
@ -61,7 +61,7 @@ def _get_ansible_type(value_type):
|
|||||||
return value_type
|
return value_type
|
||||||
|
|
||||||
|
|
||||||
class Option(object):
|
class Option:
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
name,
|
name,
|
||||||
@ -148,7 +148,7 @@ class Option(object):
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class OptionGroup(object):
|
class OptionGroup:
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
preprocess=None,
|
preprocess=None,
|
||||||
@ -205,7 +205,7 @@ class OptionGroup(object):
|
|||||||
return self
|
return self
|
||||||
|
|
||||||
|
|
||||||
class Engine(object):
|
class Engine:
|
||||||
min_api_version = None # string or None
|
min_api_version = None # string or None
|
||||||
min_api_version_obj = None # LooseVersion object or None
|
min_api_version_obj = None # LooseVersion object or None
|
||||||
extra_option_minimal_versions = None # dict[str, dict[str, Any]] or None
|
extra_option_minimal_versions = None # dict[str, dict[str, Any]] or None
|
||||||
@ -265,7 +265,7 @@ class Engine(object):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class EngineDriver(object):
|
class EngineDriver:
|
||||||
name = None # string
|
name = None # string
|
||||||
|
|
||||||
@abc.abstractmethod
|
@abc.abstractmethod
|
||||||
|
|||||||
@ -26,7 +26,7 @@ from ansible_collections.community.docker.plugins.module_utils._util import (
|
|||||||
|
|
||||||
class Container(DockerBaseClass):
|
class Container(DockerBaseClass):
|
||||||
def __init__(self, container, engine_driver):
|
def __init__(self, container, engine_driver):
|
||||||
super(Container, self).__init__()
|
super().__init__()
|
||||||
self.raw = container
|
self.raw = container
|
||||||
self.id = None
|
self.id = None
|
||||||
self.image = None
|
self.image = None
|
||||||
|
|||||||
@ -128,7 +128,7 @@ def _normalize_arch(arch_str, variant_str):
|
|||||||
return arch_str, variant_str
|
return arch_str, variant_str
|
||||||
|
|
||||||
|
|
||||||
class _Platform(object):
|
class _Platform:
|
||||||
def __init__(self, os=None, arch=None, variant=None):
|
def __init__(self, os=None, arch=None, variant=None):
|
||||||
self.os = os
|
self.os = os
|
||||||
self.arch = arch
|
self.arch = arch
|
||||||
|
|||||||
@ -25,7 +25,7 @@ from ansible_collections.community.docker.plugins.module_utils._socket_helper im
|
|||||||
PARAMIKO_POLL_TIMEOUT = 0.01 # 10 milliseconds
|
PARAMIKO_POLL_TIMEOUT = 0.01 # 10 milliseconds
|
||||||
|
|
||||||
|
|
||||||
class DockerSocketHandlerBase(object):
|
class DockerSocketHandlerBase:
|
||||||
def __init__(self, sock, selectors, log=None):
|
def __init__(self, sock, selectors, log=None):
|
||||||
make_unblocking(sock)
|
make_unblocking(sock)
|
||||||
|
|
||||||
@ -212,4 +212,4 @@ class DockerSocketHandlerBase(object):
|
|||||||
|
|
||||||
class DockerSocketHandlerModule(DockerSocketHandlerBase):
|
class DockerSocketHandlerModule(DockerSocketHandlerBase):
|
||||||
def __init__(self, sock, module, selectors):
|
def __init__(self, sock, module, selectors):
|
||||||
super(DockerSocketHandlerModule, self).__init__(sock, selectors, module.debug)
|
super().__init__(sock, selectors, module.debug)
|
||||||
|
|||||||
@ -29,7 +29,7 @@ from ansible_collections.community.docker.plugins.module_utils._version import (
|
|||||||
class AnsibleDockerSwarmClient(AnsibleDockerClient):
|
class AnsibleDockerSwarmClient(AnsibleDockerClient):
|
||||||
|
|
||||||
def __init__(self, **kwargs):
|
def __init__(self, **kwargs):
|
||||||
super(AnsibleDockerSwarmClient, self).__init__(**kwargs)
|
super().__init__(**kwargs)
|
||||||
|
|
||||||
def get_swarm_node_id(self):
|
def get_swarm_node_id(self):
|
||||||
"""
|
"""
|
||||||
@ -271,7 +271,7 @@ class AnsibleDockerSwarmClient(AnsibleDockerClient):
|
|||||||
def get_unlock_key(self):
|
def get_unlock_key(self):
|
||||||
if self.docker_py_version < LooseVersion("2.7.0"):
|
if self.docker_py_version < LooseVersion("2.7.0"):
|
||||||
return None
|
return None
|
||||||
return super(AnsibleDockerSwarmClient, self).get_unlock_key()
|
return super().get_unlock_key()
|
||||||
|
|
||||||
def get_service_inspect(self, service_id, skip_missing=False):
|
def get_service_inspect(self, service_id, skip_missing=False):
|
||||||
"""
|
"""
|
||||||
|
|||||||
@ -121,7 +121,7 @@ def log_debug(msg, pretty_print=False):
|
|||||||
log_file.write(f"{msg}\n")
|
log_file.write(f"{msg}\n")
|
||||||
|
|
||||||
|
|
||||||
class DockerBaseClass(object):
|
class DockerBaseClass:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.debug = False
|
self.debug = False
|
||||||
|
|
||||||
@ -245,7 +245,7 @@ def compare_generic(a, b, method, datatype):
|
|||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
class DifferenceTracker(object):
|
class DifferenceTracker:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self._diff = []
|
self._diff = []
|
||||||
|
|
||||||
|
|||||||
@ -455,7 +455,7 @@ from ansible_collections.community.docker.plugins.module_utils._version import (
|
|||||||
|
|
||||||
class ServicesManager(BaseComposeManager):
|
class ServicesManager(BaseComposeManager):
|
||||||
def __init__(self, client):
|
def __init__(self, client):
|
||||||
super(ServicesManager, self).__init__(client)
|
super().__init__(client)
|
||||||
parameters = self.client.module.params
|
parameters = self.client.module.params
|
||||||
|
|
||||||
self.state = parameters["state"]
|
self.state = parameters["state"]
|
||||||
|
|||||||
@ -180,7 +180,7 @@ from ansible_collections.community.docker.plugins.module_utils._compose_v2 impor
|
|||||||
|
|
||||||
class ExecManager(BaseComposeManager):
|
class ExecManager(BaseComposeManager):
|
||||||
def __init__(self, client):
|
def __init__(self, client):
|
||||||
super(ExecManager, self).__init__(client)
|
super().__init__(client)
|
||||||
parameters = self.client.module.params
|
parameters = self.client.module.params
|
||||||
|
|
||||||
self.service = parameters["service"]
|
self.service = parameters["service"]
|
||||||
|
|||||||
@ -127,7 +127,7 @@ from ansible_collections.community.docker.plugins.module_utils._version import (
|
|||||||
|
|
||||||
class PullManager(BaseComposeManager):
|
class PullManager(BaseComposeManager):
|
||||||
def __init__(self, client):
|
def __init__(self, client):
|
||||||
super(PullManager, self).__init__(client)
|
super().__init__(client)
|
||||||
parameters = self.client.module.params
|
parameters = self.client.module.params
|
||||||
|
|
||||||
self.policy = parameters["policy"]
|
self.policy = parameters["policy"]
|
||||||
|
|||||||
@ -253,7 +253,7 @@ from ansible_collections.community.docker.plugins.module_utils._compose_v2 impor
|
|||||||
|
|
||||||
class ExecManager(BaseComposeManager):
|
class ExecManager(BaseComposeManager):
|
||||||
def __init__(self, client):
|
def __init__(self, client):
|
||||||
super(ExecManager, self).__init__(client)
|
super().__init__(client)
|
||||||
parameters = self.client.module.params
|
parameters = self.client.module.params
|
||||||
|
|
||||||
self.service = parameters["service"]
|
self.service = parameters["service"]
|
||||||
|
|||||||
@ -222,7 +222,7 @@ class ConfigManager(DockerBaseClass):
|
|||||||
|
|
||||||
def __init__(self, client, results):
|
def __init__(self, client, results):
|
||||||
|
|
||||||
super(ConfigManager, self).__init__()
|
super().__init__()
|
||||||
|
|
||||||
self.client = client
|
self.client = client
|
||||||
self.results = results
|
self.results = results
|
||||||
|
|||||||
@ -234,7 +234,7 @@ class DockerHostManager(DockerBaseClass):
|
|||||||
|
|
||||||
def __init__(self, client, results):
|
def __init__(self, client, results):
|
||||||
|
|
||||||
super(DockerHostManager, self).__init__()
|
super().__init__()
|
||||||
|
|
||||||
self.client = client
|
self.client = client
|
||||||
self.results = results
|
self.results = results
|
||||||
|
|||||||
@ -433,7 +433,7 @@ class ImageManager(DockerBaseClass):
|
|||||||
:type results: dict
|
:type results: dict
|
||||||
"""
|
"""
|
||||||
|
|
||||||
super(ImageManager, self).__init__()
|
super().__init__()
|
||||||
|
|
||||||
self.client = client
|
self.client = client
|
||||||
self.results = results
|
self.results = results
|
||||||
|
|||||||
@ -327,7 +327,7 @@ def _quote_csv(text):
|
|||||||
|
|
||||||
class ImageBuilder(DockerBaseClass):
|
class ImageBuilder(DockerBaseClass):
|
||||||
def __init__(self, client):
|
def __init__(self, client):
|
||||||
super(ImageBuilder, self).__init__()
|
super().__init__()
|
||||||
self.client = client
|
self.client = client
|
||||||
self.check_mode = self.client.check_mode
|
self.check_mode = self.client.check_mode
|
||||||
parameters = self.client.module.params
|
parameters = self.client.module.params
|
||||||
|
|||||||
@ -122,7 +122,7 @@ from ansible_collections.community.docker.plugins.module_utils._util import (
|
|||||||
|
|
||||||
class ImageExportManager(DockerBaseClass):
|
class ImageExportManager(DockerBaseClass):
|
||||||
def __init__(self, client):
|
def __init__(self, client):
|
||||||
super(ImageExportManager, self).__init__()
|
super().__init__()
|
||||||
|
|
||||||
self.client = client
|
self.client = client
|
||||||
parameters = self.client.module.params
|
parameters = self.client.module.params
|
||||||
|
|||||||
@ -158,7 +158,7 @@ class ImageManager(DockerBaseClass):
|
|||||||
|
|
||||||
def __init__(self, client, results):
|
def __init__(self, client, results):
|
||||||
|
|
||||||
super(ImageManager, self).__init__()
|
super().__init__()
|
||||||
|
|
||||||
self.client = client
|
self.client = client
|
||||||
self.results = results
|
self.results = results
|
||||||
|
|||||||
@ -96,7 +96,7 @@ from ansible_collections.community.docker.plugins.module_utils._util import (
|
|||||||
|
|
||||||
class ImageManager(DockerBaseClass):
|
class ImageManager(DockerBaseClass):
|
||||||
def __init__(self, client, results):
|
def __init__(self, client, results):
|
||||||
super(ImageManager, self).__init__()
|
super().__init__()
|
||||||
|
|
||||||
self.client = client
|
self.client = client
|
||||||
self.results = results
|
self.results = results
|
||||||
|
|||||||
@ -125,7 +125,7 @@ def image_info(image):
|
|||||||
|
|
||||||
class ImagePuller(DockerBaseClass):
|
class ImagePuller(DockerBaseClass):
|
||||||
def __init__(self, client):
|
def __init__(self, client):
|
||||||
super(ImagePuller, self).__init__()
|
super().__init__()
|
||||||
|
|
||||||
self.client = client
|
self.client = client
|
||||||
self.check_mode = self.client.check_mode
|
self.check_mode = self.client.check_mode
|
||||||
|
|||||||
@ -97,7 +97,7 @@ from ansible_collections.community.docker.plugins.module_utils._util import (
|
|||||||
|
|
||||||
class ImagePusher(DockerBaseClass):
|
class ImagePusher(DockerBaseClass):
|
||||||
def __init__(self, client):
|
def __init__(self, client):
|
||||||
super(ImagePusher, self).__init__()
|
super().__init__()
|
||||||
|
|
||||||
self.client = client
|
self.client = client
|
||||||
self.check_mode = self.client.check_mode
|
self.check_mode = self.client.check_mode
|
||||||
|
|||||||
@ -120,7 +120,7 @@ from ansible_collections.community.docker.plugins.module_utils._util import (
|
|||||||
class ImageRemover(DockerBaseClass):
|
class ImageRemover(DockerBaseClass):
|
||||||
|
|
||||||
def __init__(self, client):
|
def __init__(self, client):
|
||||||
super(ImageRemover, self).__init__()
|
super().__init__()
|
||||||
|
|
||||||
self.client = client
|
self.client = client
|
||||||
self.check_mode = self.client.check_mode
|
self.check_mode = self.client.check_mode
|
||||||
|
|||||||
@ -142,7 +142,7 @@ def image_info(name, tag, image):
|
|||||||
|
|
||||||
class ImageTagger(DockerBaseClass):
|
class ImageTagger(DockerBaseClass):
|
||||||
def __init__(self, client):
|
def __init__(self, client):
|
||||||
super(ImageTagger, self).__init__()
|
super().__init__()
|
||||||
|
|
||||||
self.client = client
|
self.client = client
|
||||||
parameters = self.client.module.params
|
parameters = self.client.module.params
|
||||||
|
|||||||
@ -145,7 +145,7 @@ from ansible_collections.community.docker.plugins.module_utils._util import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class DockerFileStore(object):
|
class DockerFileStore:
|
||||||
"""
|
"""
|
||||||
A custom credential store class that implements only the functionality we need to
|
A custom credential store class that implements only the functionality we need to
|
||||||
update the docker config file when no credential helpers is provided.
|
update the docker config file when no credential helpers is provided.
|
||||||
@ -238,7 +238,7 @@ class LoginManager(DockerBaseClass):
|
|||||||
|
|
||||||
def __init__(self, client, results):
|
def __init__(self, client, results):
|
||||||
|
|
||||||
super(LoginManager, self).__init__()
|
super().__init__()
|
||||||
|
|
||||||
self.client = client
|
self.client = client
|
||||||
self.results = results
|
self.results = results
|
||||||
|
|||||||
@ -303,7 +303,7 @@ from ansible_collections.community.docker.plugins.module_utils._util import (
|
|||||||
|
|
||||||
class TaskParameters(DockerBaseClass):
|
class TaskParameters(DockerBaseClass):
|
||||||
def __init__(self, client):
|
def __init__(self, client):
|
||||||
super(TaskParameters, self).__init__()
|
super().__init__()
|
||||||
self.client = client
|
self.client = client
|
||||||
|
|
||||||
self.name = None
|
self.name = None
|
||||||
@ -385,7 +385,7 @@ def dicts_are_essentially_equal(a, b):
|
|||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
class DockerNetworkManager(object):
|
class DockerNetworkManager:
|
||||||
|
|
||||||
def __init__(self, client):
|
def __init__(self, client):
|
||||||
self.client = client
|
self.client = client
|
||||||
|
|||||||
@ -157,7 +157,7 @@ from ansible_collections.community.docker.plugins.module_utils._util import (
|
|||||||
|
|
||||||
class TaskParameters(DockerBaseClass):
|
class TaskParameters(DockerBaseClass):
|
||||||
def __init__(self, client):
|
def __init__(self, client):
|
||||||
super(TaskParameters, self).__init__()
|
super().__init__()
|
||||||
|
|
||||||
# Spec
|
# Spec
|
||||||
self.name = None
|
self.name = None
|
||||||
@ -179,7 +179,7 @@ class SwarmNodeManager(DockerBaseClass):
|
|||||||
|
|
||||||
def __init__(self, client, results):
|
def __init__(self, client, results):
|
||||||
|
|
||||||
super(SwarmNodeManager, self).__init__()
|
super().__init__()
|
||||||
|
|
||||||
self.client = client
|
self.client = client
|
||||||
self.results = results
|
self.results = results
|
||||||
|
|||||||
@ -149,7 +149,7 @@ from ansible_collections.community.docker.plugins.module_utils._util import (
|
|||||||
|
|
||||||
class TaskParameters(DockerBaseClass):
|
class TaskParameters(DockerBaseClass):
|
||||||
def __init__(self, client):
|
def __init__(self, client):
|
||||||
super(TaskParameters, self).__init__()
|
super().__init__()
|
||||||
self.client = client
|
self.client = client
|
||||||
self.plugin_name = None
|
self.plugin_name = None
|
||||||
self.alias = None
|
self.alias = None
|
||||||
@ -174,7 +174,7 @@ def parse_options(options_list):
|
|||||||
return dict(x.split("=", 1) for x in options_list) if options_list else {}
|
return dict(x.split("=", 1) for x in options_list) if options_list else {}
|
||||||
|
|
||||||
|
|
||||||
class DockerPluginManager(object):
|
class DockerPluginManager:
|
||||||
|
|
||||||
def __init__(self, client):
|
def __init__(self, client):
|
||||||
self.client = client
|
self.client = client
|
||||||
|
|||||||
@ -214,7 +214,7 @@ class SecretManager(DockerBaseClass):
|
|||||||
|
|
||||||
def __init__(self, client, results):
|
def __init__(self, client, results):
|
||||||
|
|
||||||
super(SecretManager, self).__init__()
|
super().__init__()
|
||||||
|
|
||||||
self.client = client
|
self.client = client
|
||||||
self.results = results
|
self.results = results
|
||||||
|
|||||||
@ -315,7 +315,7 @@ from ansible_collections.community.docker.plugins.module_utils._util import (
|
|||||||
|
|
||||||
class TaskParameters(DockerBaseClass):
|
class TaskParameters(DockerBaseClass):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super(TaskParameters, self).__init__()
|
super().__init__()
|
||||||
|
|
||||||
self.advertise_addr = None
|
self.advertise_addr = None
|
||||||
self.listen_addr = None
|
self.listen_addr = None
|
||||||
@ -461,7 +461,7 @@ class SwarmManager(DockerBaseClass):
|
|||||||
|
|
||||||
def __init__(self, client, results):
|
def __init__(self, client, results):
|
||||||
|
|
||||||
super(SwarmManager, self).__init__()
|
super().__init__()
|
||||||
|
|
||||||
self.client = client
|
self.client = client
|
||||||
self.results = results
|
self.results = results
|
||||||
|
|||||||
@ -210,7 +210,7 @@ class DockerSwarmManager(DockerBaseClass):
|
|||||||
|
|
||||||
def __init__(self, client, results):
|
def __init__(self, client, results):
|
||||||
|
|
||||||
super(DockerSwarmManager, self).__init__()
|
super().__init__()
|
||||||
|
|
||||||
self.client = client
|
self.client = client
|
||||||
self.results = results
|
self.results = results
|
||||||
|
|||||||
@ -1127,7 +1127,7 @@ def have_networks_changed(new_networks, old_networks):
|
|||||||
|
|
||||||
class DockerService(DockerBaseClass):
|
class DockerService(DockerBaseClass):
|
||||||
def __init__(self, docker_api_version, docker_py_version):
|
def __init__(self, docker_api_version, docker_py_version):
|
||||||
super(DockerService, self).__init__()
|
super().__init__()
|
||||||
self.image = ""
|
self.image = ""
|
||||||
self.command = None
|
self.command = None
|
||||||
self.args = None
|
self.args = None
|
||||||
@ -2174,7 +2174,7 @@ class DockerService(DockerBaseClass):
|
|||||||
return service
|
return service
|
||||||
|
|
||||||
|
|
||||||
class DockerServiceManager(object):
|
class DockerServiceManager:
|
||||||
|
|
||||||
def __init__(self, client):
|
def __init__(self, client):
|
||||||
self.client = client
|
self.client = client
|
||||||
|
|||||||
@ -137,7 +137,7 @@ from ansible_collections.community.docker.plugins.module_utils._util import (
|
|||||||
|
|
||||||
class TaskParameters(DockerBaseClass):
|
class TaskParameters(DockerBaseClass):
|
||||||
def __init__(self, client):
|
def __init__(self, client):
|
||||||
super(TaskParameters, self).__init__()
|
super().__init__()
|
||||||
self.client = client
|
self.client = client
|
||||||
|
|
||||||
self.volume_name = None
|
self.volume_name = None
|
||||||
@ -151,7 +151,7 @@ class TaskParameters(DockerBaseClass):
|
|||||||
setattr(self, key, value)
|
setattr(self, key, value)
|
||||||
|
|
||||||
|
|
||||||
class DockerVolumeManager(object):
|
class DockerVolumeManager:
|
||||||
|
|
||||||
def __init__(self, client):
|
def __init__(self, client):
|
||||||
self.client = client
|
self.client = client
|
||||||
|
|||||||
@ -7,10 +7,6 @@
|
|||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
|
|
||||||
__metaclass__ = type
|
|
||||||
|
|
||||||
|
|
||||||
from ansible.errors import AnsibleConnectionFailure
|
from ansible.errors import AnsibleConnectionFailure
|
||||||
from ansible.utils.display import Display
|
from ansible.utils.display import Display
|
||||||
from ansible_collections.community.docker.plugins.module_utils._common import (
|
from ansible_collections.community.docker.plugins.module_utils._common import (
|
||||||
@ -25,7 +21,7 @@ class AnsibleDockerClient(AnsibleDockerClientBase):
|
|||||||
def __init__(self, plugin, min_docker_version=None, min_docker_api_version=None):
|
def __init__(self, plugin, min_docker_version=None, min_docker_api_version=None):
|
||||||
self.plugin = plugin
|
self.plugin = plugin
|
||||||
self.display = Display()
|
self.display = Display()
|
||||||
super(AnsibleDockerClient, self).__init__(
|
super().__init__(
|
||||||
min_docker_version=min_docker_version,
|
min_docker_version=min_docker_version,
|
||||||
min_docker_api_version=min_docker_api_version,
|
min_docker_api_version=min_docker_api_version,
|
||||||
)
|
)
|
||||||
|
|||||||
@ -21,9 +21,7 @@ class AnsibleDockerClient(AnsibleDockerClientBase):
|
|||||||
def __init__(self, plugin, min_docker_api_version=None):
|
def __init__(self, plugin, min_docker_api_version=None):
|
||||||
self.plugin = plugin
|
self.plugin = plugin
|
||||||
self.display = Display()
|
self.display = Display()
|
||||||
super(AnsibleDockerClient, self).__init__(
|
super().__init__(min_docker_api_version=min_docker_api_version)
|
||||||
min_docker_api_version=min_docker_api_version
|
|
||||||
)
|
|
||||||
|
|
||||||
def fail(self, msg, **kwargs):
|
def fail(self, msg, **kwargs):
|
||||||
if kwargs:
|
if kwargs:
|
||||||
|
|||||||
@ -7,10 +7,6 @@
|
|||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
|
|
||||||
__metaclass__ = type
|
|
||||||
|
|
||||||
|
|
||||||
import selectors
|
import selectors
|
||||||
|
|
||||||
from ansible_collections.community.docker.plugins.module_utils._socket_handler import (
|
from ansible_collections.community.docker.plugins.module_utils._socket_handler import (
|
||||||
@ -20,6 +16,6 @@ from ansible_collections.community.docker.plugins.module_utils._socket_handler i
|
|||||||
|
|
||||||
class DockerSocketHandler(DockerSocketHandlerBase):
|
class DockerSocketHandler(DockerSocketHandlerBase):
|
||||||
def __init__(self, display, sock, log=None, container=None):
|
def __init__(self, display, sock, log=None, container=None):
|
||||||
super(DockerSocketHandler, self).__init__(
|
super().__init__(
|
||||||
sock, selectors, log=lambda msg: display.vvvv(msg, host=container)
|
sock, selectors, log=lambda msg: display.vvvv(msg, host=container)
|
||||||
)
|
)
|
||||||
|
|||||||
@ -3,7 +3,6 @@
|
|||||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
__metaclass__ = type
|
|
||||||
|
|
||||||
|
|
||||||
def _normalize_ipaddr(ipaddr):
|
def _normalize_ipaddr(ipaddr):
|
||||||
@ -12,7 +11,7 @@ def _normalize_ipaddr(ipaddr):
|
|||||||
return ipaddress.ip_address(ipaddr).compressed
|
return ipaddress.ip_address(ipaddr).compressed
|
||||||
|
|
||||||
|
|
||||||
class FilterModule(object):
|
class FilterModule:
|
||||||
""" IP address and network manipulation filters """
|
""" IP address and network manipulation filters """
|
||||||
|
|
||||||
def filters(self):
|
def filters(self):
|
||||||
|
|||||||
@ -3,7 +3,6 @@
|
|||||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
__metaclass__ = type
|
|
||||||
|
|
||||||
|
|
||||||
def sanitize_host_info(data):
|
def sanitize_host_info(data):
|
||||||
|
|||||||
@ -4,9 +4,6 @@
|
|||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
|
|
||||||
__metaclass__ = type
|
|
||||||
|
|
||||||
from io import StringIO
|
from io import StringIO
|
||||||
|
|
||||||
from ansible.errors import AnsibleError
|
from ansible.errors import AnsibleError
|
||||||
|
|||||||
@ -4,10 +4,6 @@
|
|||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
|
|
||||||
__metaclass__ = type
|
|
||||||
|
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
from ansible.inventory.data import InventoryData
|
from ansible.inventory.data import InventoryData
|
||||||
from ansible.parsing.dataloader import DataLoader
|
from ansible.parsing.dataloader import DataLoader
|
||||||
@ -96,7 +92,7 @@ def create_get_option(options, default=False):
|
|||||||
return get_option
|
return get_option
|
||||||
|
|
||||||
|
|
||||||
class FakeClient(object):
|
class FakeClient:
|
||||||
def __init__(self, *hosts):
|
def __init__(self, *hosts):
|
||||||
self.get_results = {}
|
self.get_results = {}
|
||||||
list_reply = []
|
list_reply = []
|
||||||
|
|||||||
@ -8,9 +8,6 @@
|
|||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
|
|
||||||
__metaclass__ = type
|
|
||||||
|
|
||||||
import datetime
|
import datetime
|
||||||
import io
|
import io
|
||||||
import json
|
import json
|
||||||
@ -483,7 +480,7 @@ class TCPSocketStreamTest(unittest.TestCase):
|
|||||||
stdout_data = cls.stdout_data
|
stdout_data = cls.stdout_data
|
||||||
stderr_data = cls.stderr_data
|
stderr_data = cls.stderr_data
|
||||||
|
|
||||||
class Handler(BaseHTTPRequestHandler, object):
|
class Handler(BaseHTTPRequestHandler):
|
||||||
def do_POST(self):
|
def do_POST(self):
|
||||||
resp_data = self.get_resp_data()
|
resp_data = self.get_resp_data()
|
||||||
self.send_response(101)
|
self.send_response(101)
|
||||||
|
|||||||
@ -9,6 +9,4 @@
|
|||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
|
|
||||||
__metaclass__ = type
|
|
||||||
|
|
||||||
DEFAULT_DOCKER_API_VERSION = "1.45"
|
DEFAULT_DOCKER_API_VERSION = "1.45"
|
||||||
|
|||||||
@ -8,9 +8,6 @@
|
|||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
|
|
||||||
__metaclass__ = type
|
|
||||||
|
|
||||||
from ansible_collections.community.docker.plugins.module_utils._api import constants
|
from ansible_collections.community.docker.plugins.module_utils._api import constants
|
||||||
from ansible_collections.community.docker.tests.unit.plugins.module_utils._api.constants import (
|
from ansible_collections.community.docker.tests.unit.plugins.module_utils._api.constants import (
|
||||||
DEFAULT_DOCKER_API_VERSION,
|
DEFAULT_DOCKER_API_VERSION,
|
||||||
|
|||||||
@ -9,8 +9,6 @@
|
|||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
|
|
||||||
__metaclass__ = type
|
|
||||||
|
|
||||||
OBJ = {
|
OBJ = {
|
||||||
"read": "2015-02-11T19:20:46.667237763+02:00",
|
"read": "2015-02-11T19:20:46.667237763+02:00",
|
||||||
"network": {
|
"network": {
|
||||||
|
|||||||
@ -8,9 +8,6 @@
|
|||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
|
|
||||||
__metaclass__ = type
|
|
||||||
|
|
||||||
import base64
|
import base64
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
|
|||||||
@ -8,9 +8,6 @@
|
|||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
|
|
||||||
__metaclass__ = type
|
|
||||||
|
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|||||||
@ -8,9 +8,6 @@
|
|||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
|
|
||||||
__metaclass__ = type
|
|
||||||
|
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
import requests
|
import requests
|
||||||
|
|||||||
@ -8,9 +8,6 @@
|
|||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
|
|
||||||
__metaclass__ = type
|
|
||||||
|
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
from ansible_collections.community.docker.plugins.module_utils._api.transport.sshconn import (
|
from ansible_collections.community.docker.plugins.module_utils._api.transport.sshconn import (
|
||||||
|
|||||||
@ -8,9 +8,6 @@
|
|||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
|
|
||||||
__metaclass__ = type
|
|
||||||
|
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|||||||
@ -8,9 +8,6 @@
|
|||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
|
|
||||||
__metaclass__ = type
|
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import os.path
|
import os.path
|
||||||
import shutil
|
import shutil
|
||||||
|
|||||||
@ -8,9 +8,6 @@
|
|||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
|
|
||||||
__metaclass__ = type
|
|
||||||
|
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
import shutil
|
import shutil
|
||||||
|
|||||||
@ -8,9 +8,6 @@
|
|||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
|
|
||||||
__metaclass__ = type
|
|
||||||
|
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
from ansible_collections.community.docker.plugins.module_utils._api.api.client import (
|
from ansible_collections.community.docker.plugins.module_utils._api.api.client import (
|
||||||
|
|||||||
@ -8,9 +8,6 @@
|
|||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
|
|
||||||
__metaclass__ = type
|
|
||||||
|
|
||||||
from ansible_collections.community.docker.plugins.module_utils._api.utils.json_stream import (
|
from ansible_collections.community.docker.plugins.module_utils._api.utils.json_stream import (
|
||||||
json_splitter,
|
json_splitter,
|
||||||
json_stream,
|
json_stream,
|
||||||
|
|||||||
@ -8,9 +8,6 @@
|
|||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
|
|
||||||
__metaclass__ = type
|
|
||||||
|
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|||||||
@ -8,9 +8,6 @@
|
|||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
|
|
||||||
__metaclass__ = type
|
|
||||||
|
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
from ansible_collections.community.docker.plugins.module_utils._api.utils.proxy import (
|
from ansible_collections.community.docker.plugins.module_utils._api.utils.proxy import (
|
||||||
|
|||||||
@ -8,9 +8,6 @@
|
|||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
|
|
||||||
__metaclass__ = type
|
|
||||||
|
|
||||||
import base64
|
import base64
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
|
|||||||
@ -4,9 +4,6 @@
|
|||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
|
|
||||||
__metaclass__ = type
|
|
||||||
|
|
||||||
from ansible_collections.community.docker.plugins.module_utils._compose_v2 import (
|
from ansible_collections.community.docker.plugins.module_utils._compose_v2 import (
|
||||||
Event,
|
Event,
|
||||||
)
|
)
|
||||||
|
|||||||
@ -4,9 +4,6 @@
|
|||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
|
|
||||||
__metaclass__ = type
|
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
from ansible_collections.community.docker.plugins.module_utils._compose_v2 import (
|
from ansible_collections.community.docker.plugins.module_utils._compose_v2 import (
|
||||||
Event,
|
Event,
|
||||||
|
|||||||
@ -4,9 +4,6 @@
|
|||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
|
|
||||||
__metaclass__ = type
|
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
from ansible_collections.community.docker.plugins.module_utils._copy import (
|
from ansible_collections.community.docker.plugins.module_utils._copy import (
|
||||||
_stream_generator_to_fileobj,
|
_stream_generator_to_fileobj,
|
||||||
|
|||||||
@ -4,9 +4,6 @@
|
|||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
|
|
||||||
__metaclass__ = type
|
|
||||||
|
|
||||||
import tarfile
|
import tarfile
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|||||||
@ -4,9 +4,6 @@
|
|||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
|
|
||||||
__metaclass__ = type
|
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
from ansible_collections.community.docker.plugins.module_utils._logfmt import (
|
from ansible_collections.community.docker.plugins.module_utils._logfmt import (
|
||||||
InvalidLogFmt,
|
InvalidLogFmt,
|
||||||
|
|||||||
@ -4,9 +4,6 @@
|
|||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
|
|
||||||
__metaclass__ = type
|
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
from ansible_collections.community.docker.plugins.module_utils._scramble import (
|
from ansible_collections.community.docker.plugins.module_utils._scramble import (
|
||||||
scramble,
|
scramble,
|
||||||
|
|||||||
@ -4,9 +4,6 @@
|
|||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
|
|
||||||
__metaclass__ = type
|
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
from ansible_collections.community.docker.plugins.module_utils._util import (
|
from ansible_collections.community.docker.plugins.module_utils._util import (
|
||||||
compare_dict_allow_more_present,
|
compare_dict_allow_more_present,
|
||||||
|
|||||||
@ -4,9 +4,6 @@
|
|||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
|
|
||||||
__metaclass__ = type
|
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
from ansible_collections.community.docker.plugins.modules.docker_container_copy_into import (
|
from ansible_collections.community.docker.plugins.modules.docker_container_copy_into import (
|
||||||
parse_modern,
|
parse_modern,
|
||||||
|
|||||||
@ -4,9 +4,6 @@
|
|||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
|
|
||||||
__metaclass__ = type
|
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
from ansible_collections.community.docker.plugins.module_utils._image_archive import (
|
from ansible_collections.community.docker.plugins.module_utils._image_archive import (
|
||||||
api_image_id,
|
api_image_id,
|
||||||
|
|||||||
@ -4,9 +4,6 @@
|
|||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
|
|
||||||
__metaclass__ = type
|
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
from ansible_collections.community.docker.plugins.modules.docker_image_build import (
|
from ansible_collections.community.docker.plugins.modules.docker_image_build import (
|
||||||
_quote_csv,
|
_quote_csv,
|
||||||
|
|||||||
@ -6,9 +6,6 @@
|
|||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
|
|
||||||
__metaclass__ = type
|
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
from ansible_collections.community.docker.plugins.modules.docker_network import (
|
from ansible_collections.community.docker.plugins.modules.docker_network import (
|
||||||
validate_cidr,
|
validate_cidr,
|
||||||
|
|||||||
@ -4,9 +4,6 @@
|
|||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
|
|
||||||
__metaclass__ = type
|
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -4,9 +4,6 @@
|
|||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
|
|
||||||
__metaclass__ = type
|
|
||||||
|
|
||||||
import json
|
import json
|
||||||
import tarfile
|
import tarfile
|
||||||
from tempfile import TemporaryFile
|
from tempfile import TemporaryFile
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user