mirror of
https://github.com/ansible-collections/community.docker.git
synced 2026-04-11 12:22:06 +00:00
Address no-else-raise.
This commit is contained in:
parent
73a0bf93d2
commit
e3b07ed6b2
@ -384,7 +384,6 @@ disable=raw-checker-failed,
|
|||||||
consider-using-with,
|
consider-using-with,
|
||||||
fixme,
|
fixme,
|
||||||
import-error, # TODO figure out why pylint cannot find the module
|
import-error, # TODO figure out why pylint cannot find the module
|
||||||
no-else-raise,
|
|
||||||
no-else-return,
|
no-else-return,
|
||||||
no-member,
|
no-member,
|
||||||
no-name-in-module, # TODO figure out why pylint cannot find the module
|
no-name-in-module, # TODO figure out why pylint cannot find the module
|
||||||
|
|||||||
@ -159,10 +159,9 @@ class Connection(ConnectionBase):
|
|||||||
raise AnsibleConnectionFailure(
|
raise AnsibleConnectionFailure(
|
||||||
f'Could not find container "{remote_addr}" or resource in it ({e})'
|
f'Could not find container "{remote_addr}" or resource in it ({e})'
|
||||||
)
|
)
|
||||||
else:
|
raise AnsibleConnectionFailure(
|
||||||
raise AnsibleConnectionFailure(
|
f'Could not find container "{remote_addr}" ({e})'
|
||||||
f'Could not find container "{remote_addr}" ({e})'
|
)
|
||||||
)
|
|
||||||
except APIError as e:
|
except APIError as e:
|
||||||
if e.response is not None and e.response.status_code == 409:
|
if e.response is not None and e.response.status_code == 409:
|
||||||
raise AnsibleConnectionFailure(
|
raise AnsibleConnectionFailure(
|
||||||
|
|||||||
@ -91,8 +91,7 @@ class Store:
|
|||||||
raise errors.StoreError(
|
raise errors.StoreError(
|
||||||
f"{self.program} not installed or not available in PATH"
|
f"{self.program} not installed or not available in PATH"
|
||||||
)
|
)
|
||||||
else:
|
raise errors.StoreError(
|
||||||
raise errors.StoreError(
|
f'Unexpected OS error "{e.strerror}", errno={e.errno}'
|
||||||
f'Unexpected OS error "{e.strerror}", errno={e.errno}'
|
)
|
||||||
)
|
|
||||||
return output
|
return output
|
||||||
|
|||||||
@ -130,7 +130,7 @@ def mkbuildcontext(dockerfile):
|
|||||||
with tarfile.open(mode="w", fileobj=f) as t:
|
with tarfile.open(mode="w", fileobj=f) as t:
|
||||||
if isinstance(dockerfile, io.StringIO):
|
if isinstance(dockerfile, io.StringIO):
|
||||||
raise TypeError("Please use io.BytesIO to create in-memory Dockerfiles")
|
raise TypeError("Please use io.BytesIO to create in-memory Dockerfiles")
|
||||||
elif isinstance(dockerfile, io.BytesIO):
|
if isinstance(dockerfile, io.BytesIO):
|
||||||
dfinfo = tarfile.TarInfo("Dockerfile")
|
dfinfo = tarfile.TarInfo("Dockerfile")
|
||||||
dfinfo.size = len(dockerfile.getvalue())
|
dfinfo.size = len(dockerfile.getvalue())
|
||||||
dockerfile.seek(0)
|
dockerfile.seek(0)
|
||||||
|
|||||||
@ -273,12 +273,11 @@ def parse_host(addr, is_win32=False, tls=False):
|
|||||||
raise errors.DockerException(
|
raise errors.DockerException(
|
||||||
f"Invalid bind address format: no path allowed for this protocol: {addr}"
|
f"Invalid bind address format: no path allowed for this protocol: {addr}"
|
||||||
)
|
)
|
||||||
else:
|
path = parsed_url.path
|
||||||
path = parsed_url.path
|
if proto == "unix" and parsed_url.hostname is not None:
|
||||||
if proto == "unix" and parsed_url.hostname is not None:
|
# For legacy reasons, we consider unix://path
|
||||||
# For legacy reasons, we consider unix://path
|
# to be valid and equivalent to unix:///path
|
||||||
# to be valid and equivalent to unix:///path
|
path = "/".join((parsed_url.hostname, path))
|
||||||
path = "/".join((parsed_url.hostname, path))
|
|
||||||
|
|
||||||
netloc = parsed_url.netloc
|
netloc = parsed_url.netloc
|
||||||
if proto in ("tcp", "ssh"):
|
if proto in ("tcp", "ssh"):
|
||||||
|
|||||||
@ -1047,8 +1047,7 @@ def has_list_changed(new_list, old_list, sort_lists=True, sort_key=None):
|
|||||||
if unsorted_list and isinstance(unsorted_list[0], dict):
|
if unsorted_list and isinstance(unsorted_list[0], dict):
|
||||||
if not sort_key:
|
if not sort_key:
|
||||||
raise ValueError("A sort key was not specified when sorting list")
|
raise ValueError("A sort key was not specified when sorting list")
|
||||||
else:
|
return sorted(unsorted_list, key=lambda k: k[sort_key])
|
||||||
return sorted(unsorted_list, key=lambda k: k[sort_key])
|
|
||||||
|
|
||||||
# Either the list is empty or does not contain dictionaries
|
# Either the list is empty or does not contain dictionaries
|
||||||
try:
|
try:
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user