update ansible collections sops, docker and debops
This commit is contained in:
parent
f1135b818f
commit
e31ee5e39c
910 changed files with 27667 additions and 19786 deletions
|
|
@ -388,7 +388,7 @@ class APIClient(_Session):
|
|||
@t.overload
|
||||
def _stream_helper(
|
||||
self, response: Response, *, decode: t.Literal[False] = False
|
||||
) -> t.Generator[bytes]: ...
|
||||
) -> t.Generator[bytes | str]: ...
|
||||
|
||||
@t.overload
|
||||
def _stream_helper(
|
||||
|
|
@ -795,7 +795,7 @@ class APIClient(_Session):
|
|||
data: t.Any = None,
|
||||
headers: dict[str, str] | None = None,
|
||||
**kwargs: t.Any,
|
||||
) -> SocketLike:
|
||||
) -> tuple[SocketLike, Response]:
|
||||
headers = headers.copy() if headers else {}
|
||||
headers.update(
|
||||
{
|
||||
|
|
@ -803,15 +803,14 @@ class APIClient(_Session):
|
|||
"Upgrade": "tcp",
|
||||
}
|
||||
)
|
||||
return self._get_raw_response_socket(
|
||||
self._post_json(
|
||||
self._url(pathfmt, *args, versioned_api=True),
|
||||
data,
|
||||
headers=headers,
|
||||
stream=True,
|
||||
**kwargs,
|
||||
)
|
||||
response = self._post_json(
|
||||
self._url(pathfmt, *args, versioned_api=True),
|
||||
data,
|
||||
headers=headers,
|
||||
stream=True,
|
||||
**kwargs,
|
||||
)
|
||||
return self._get_raw_response_socket(response), response
|
||||
|
||||
@t.overload
|
||||
def post_json_to_stream(
|
||||
|
|
|
|||
|
|
@ -117,7 +117,9 @@ class UnixHTTPAdapter(BaseHTTPAdapter):
|
|||
|
||||
return pool
|
||||
|
||||
def request_url(self, request: PreparedRequest, proxies: Mapping[str, str]) -> str:
|
||||
def request_url(
|
||||
self, request: PreparedRequest, proxies: Mapping[str, str] | None
|
||||
) -> str:
|
||||
# The select_proxy utility in requests errors out when the provided URL
|
||||
# does not have a hostname, like is the case when using a UNIX socket.
|
||||
# Since proxies are an irrelevant notion in the case of UNIX sockets
|
||||
|
|
|
|||
|
|
@ -127,7 +127,7 @@ def frames_iter_no_tty(socket: SocketLike) -> t.Generator[tuple[int, bytes]]:
|
|||
not enabled.
|
||||
"""
|
||||
while True:
|
||||
(stream, n) = next_frame_header(socket)
|
||||
stream, n = next_frame_header(socket)
|
||||
if n < 0:
|
||||
break
|
||||
while n > 0:
|
||||
|
|
|
|||
|
|
@ -523,7 +523,10 @@ class AnsibleDockerClientBase(Client):
|
|||
) -> bool:
|
||||
if img1 is None or img2 is None:
|
||||
return img1 == img2
|
||||
filter_keys = {"Metadata"}
|
||||
filter_keys = {"Metadata", "Identity"}
|
||||
# Since Docker 29.2 (?) the order of entries in Identity.Pull can change
|
||||
# even though the image is the same. Since we're only really interested
|
||||
# in the image's Id field, we simply skip all of Identity.
|
||||
img1_filtered = {k: v for k, v in img1.items() if k not in filter_keys}
|
||||
img2_filtered = {k: v for k, v in img2.items() if k not in filter_keys}
|
||||
return img1_filtered == img2_filtered
|
||||
|
|
@ -561,7 +564,7 @@ class AnsibleDockerClientBase(Client):
|
|||
self._raise_for_status(response)
|
||||
for line in self._stream_helper(response, decode=True):
|
||||
self.log(line, pretty_print=True)
|
||||
if line.get("error"):
|
||||
if line.get("error") or line.get("errorDetail"):
|
||||
if line.get("errorDetail"):
|
||||
error_detail = line.get("errorDetail")
|
||||
self.fail(
|
||||
|
|
|
|||
|
|
@ -186,12 +186,15 @@ class AnsibleDockerClientBase:
|
|||
cwd: str | None = None,
|
||||
environ_update: dict[str, str] | None = None,
|
||||
warn_on_stderr: bool = False,
|
||||
parse_empty_as_none: bool = False,
|
||||
) -> tuple[int, t.Any, bytes]:
|
||||
rc, stdout, stderr = self.call_cli(
|
||||
*args, check_rc=check_rc, data=data, cwd=cwd, environ_update=environ_update
|
||||
)
|
||||
if warn_on_stderr and stderr:
|
||||
self.warn(to_text(stderr))
|
||||
if parse_empty_as_none and not stdout.strip():
|
||||
return rc, None, stderr
|
||||
try:
|
||||
data = json.loads(stdout)
|
||||
except Exception as exc: # pylint: disable=broad-exception-caught
|
||||
|
|
|
|||
|
|
@ -707,7 +707,7 @@ def update_failed(
|
|||
result: dict[str, t.Any],
|
||||
events: Sequence[Event],
|
||||
args: list[str],
|
||||
stdout: str | bytes,
|
||||
stdout: str | bytes | None,
|
||||
stderr: str | bytes,
|
||||
rc: int,
|
||||
cli: str,
|
||||
|
|
@ -739,7 +739,7 @@ def update_failed(
|
|||
result["failed"] = True
|
||||
result["msg"] = "\n".join(errors)
|
||||
result["cmd"] = " ".join(quote(arg) for arg in [cli] + args)
|
||||
result["stdout"] = to_text(stdout)
|
||||
result["stdout"] = to_text(stdout) if stdout is not None else ""
|
||||
result["stderr"] = to_text(stderr)
|
||||
result["rc"] = rc
|
||||
return True
|
||||
|
|
@ -900,7 +900,7 @@ class BaseComposeManager(DockerBaseClass):
|
|||
return args
|
||||
|
||||
def _handle_failed_cli_call(
|
||||
self, args: list[str], rc: int, stdout: str | bytes, stderr: bytes
|
||||
self, args: list[str], rc: int, stdout: str | bytes | None, stderr: bytes
|
||||
) -> t.NoReturn:
|
||||
events = parse_json_events(stderr, warn_function=self.client.warn)
|
||||
result: dict[str, t.Any] = {}
|
||||
|
|
@ -945,15 +945,20 @@ class BaseComposeManager(DockerBaseClass):
|
|||
def list_images(self) -> list[str]:
|
||||
args = self.get_base_args() + ["images", "--format", "json"]
|
||||
rc, images, stderr = self.client.call_cli_json(
|
||||
*args, cwd=self.project_src, check_rc=not self.use_json_events
|
||||
*args,
|
||||
cwd=self.project_src,
|
||||
check_rc=not self.use_json_events,
|
||||
parse_empty_as_none=True,
|
||||
)
|
||||
if self.use_json_events and rc != 0:
|
||||
self._handle_failed_cli_call(args, rc, images, stderr)
|
||||
if images is None:
|
||||
return []
|
||||
if isinstance(images, dict):
|
||||
# Handle breaking change in Docker Compose 2.37.0; see
|
||||
# https://github.com/ansible-collections/community.docker/issues/1082
|
||||
# and https://github.com/docker/compose/issues/12916 for details
|
||||
images = list(images.values())
|
||||
return list(images.values())
|
||||
return images
|
||||
|
||||
def parse_events(
|
||||
|
|
@ -994,7 +999,7 @@ class BaseComposeManager(DockerBaseClass):
|
|||
result: dict[str, t.Any],
|
||||
events: Sequence[Event],
|
||||
args: list[str],
|
||||
stdout: str | bytes,
|
||||
stdout: str | bytes | None,
|
||||
stderr: bytes,
|
||||
rc: int,
|
||||
) -> bool:
|
||||
|
|
|
|||
Loading…
Reference in a new issue