mirror of
https://github.com/ansible-collections/community.docker.git
synced 2026-03-16 04:04:31 +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,
|
||||
fixme,
|
||||
import-error, # TODO figure out why pylint cannot find the module
|
||||
no-else-raise,
|
||||
no-else-return,
|
||||
no-member,
|
||||
no-name-in-module, # TODO figure out why pylint cannot find the module
|
||||
|
||||
@ -159,10 +159,9 @@ class Connection(ConnectionBase):
|
||||
raise AnsibleConnectionFailure(
|
||||
f'Could not find container "{remote_addr}" or resource in it ({e})'
|
||||
)
|
||||
else:
|
||||
raise AnsibleConnectionFailure(
|
||||
f'Could not find container "{remote_addr}" ({e})'
|
||||
)
|
||||
raise AnsibleConnectionFailure(
|
||||
f'Could not find container "{remote_addr}" ({e})'
|
||||
)
|
||||
except APIError as e:
|
||||
if e.response is not None and e.response.status_code == 409:
|
||||
raise AnsibleConnectionFailure(
|
||||
|
||||
@ -91,8 +91,7 @@ class Store:
|
||||
raise errors.StoreError(
|
||||
f"{self.program} not installed or not available in PATH"
|
||||
)
|
||||
else:
|
||||
raise errors.StoreError(
|
||||
f'Unexpected OS error "{e.strerror}", errno={e.errno}'
|
||||
)
|
||||
raise errors.StoreError(
|
||||
f'Unexpected OS error "{e.strerror}", errno={e.errno}'
|
||||
)
|
||||
return output
|
||||
|
||||
@ -130,7 +130,7 @@ def mkbuildcontext(dockerfile):
|
||||
with tarfile.open(mode="w", fileobj=f) as t:
|
||||
if isinstance(dockerfile, io.StringIO):
|
||||
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.size = len(dockerfile.getvalue())
|
||||
dockerfile.seek(0)
|
||||
|
||||
@ -273,12 +273,11 @@ def parse_host(addr, is_win32=False, tls=False):
|
||||
raise errors.DockerException(
|
||||
f"Invalid bind address format: no path allowed for this protocol: {addr}"
|
||||
)
|
||||
else:
|
||||
path = parsed_url.path
|
||||
if proto == "unix" and parsed_url.hostname is not None:
|
||||
# For legacy reasons, we consider unix://path
|
||||
# to be valid and equivalent to unix:///path
|
||||
path = "/".join((parsed_url.hostname, path))
|
||||
path = parsed_url.path
|
||||
if proto == "unix" and parsed_url.hostname is not None:
|
||||
# For legacy reasons, we consider unix://path
|
||||
# to be valid and equivalent to unix:///path
|
||||
path = "/".join((parsed_url.hostname, path))
|
||||
|
||||
netloc = parsed_url.netloc
|
||||
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 not sort_key:
|
||||
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
|
||||
try:
|
||||
|
||||
Loading…
Reference in New Issue
Block a user