mirror of
https://github.com/ansible-collections/community.docker.git
synced 2025-12-17 04:18:42 +00:00
Address possibly-used-before-assignment.
This commit is contained in:
parent
776f95f295
commit
25f89d3663
@ -402,7 +402,6 @@ disable=raw-checker-failed,
|
||||
no-member,
|
||||
no-name-in-module,
|
||||
not-an-iterable,
|
||||
possibly-used-before-assignment,
|
||||
protected-access,
|
||||
raise-missing-from,
|
||||
redefined-outer-name, # needed for test fixtures
|
||||
|
||||
@ -425,11 +425,13 @@ class Connection(ConnectionBase):
|
||||
+ to_native(become_output)
|
||||
)
|
||||
|
||||
chunk = None
|
||||
for key, event in events:
|
||||
if key.fileobj == p.stdout:
|
||||
chunk = p.stdout.read()
|
||||
elif key.fileobj == p.stderr:
|
||||
chunk = p.stderr.read()
|
||||
# TODO: avoid chunk being set multiple times!
|
||||
|
||||
if not chunk:
|
||||
stdout, stderr = p.communicate()
|
||||
|
||||
@ -177,11 +177,13 @@ class Connection(ConnectionBase):
|
||||
+ to_native(become_output)
|
||||
)
|
||||
|
||||
chunk = None
|
||||
for key, event in events:
|
||||
if key.fileobj == p.stdout:
|
||||
chunk = p.stdout.read()
|
||||
elif key.fileobj == p.stderr:
|
||||
chunk = p.stderr.read()
|
||||
# TODO: avoid chunk being set multiple times!
|
||||
|
||||
if not chunk:
|
||||
stdout, stderr = p.communicate()
|
||||
|
||||
@ -859,7 +859,7 @@ def _preprocess_ports(module, values):
|
||||
else:
|
||||
port_binds = len(container_ports) * [(ipaddr,)]
|
||||
else:
|
||||
module.fail_json(
|
||||
return module.fail_json(
|
||||
msg=f'Invalid port description "{port}" - expected 1 to 3 colon-separated parts, but got {p_len}. '
|
||||
"Maybe you forgot to use square brackets ([...]) around an IPv6 address?"
|
||||
)
|
||||
|
||||
@ -499,6 +499,8 @@ class ServicesManager(BaseComposeManager):
|
||||
result = self.cmd_restart()
|
||||
elif self.state == "absent":
|
||||
result = self.cmd_down()
|
||||
else:
|
||||
raise AssertionError("Unexpected state")
|
||||
|
||||
result["containers"] = self.list_containers()
|
||||
result["images"] = self.list_images()
|
||||
|
||||
Loading…
Reference in New Issue
Block a user