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-member,
|
||||||
no-name-in-module,
|
no-name-in-module,
|
||||||
not-an-iterable,
|
not-an-iterable,
|
||||||
possibly-used-before-assignment,
|
|
||||||
protected-access,
|
protected-access,
|
||||||
raise-missing-from,
|
raise-missing-from,
|
||||||
redefined-outer-name, # needed for test fixtures
|
redefined-outer-name, # needed for test fixtures
|
||||||
|
|||||||
@ -425,11 +425,13 @@ class Connection(ConnectionBase):
|
|||||||
+ to_native(become_output)
|
+ to_native(become_output)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
chunk = None
|
||||||
for key, event in events:
|
for key, event in events:
|
||||||
if key.fileobj == p.stdout:
|
if key.fileobj == p.stdout:
|
||||||
chunk = p.stdout.read()
|
chunk = p.stdout.read()
|
||||||
elif key.fileobj == p.stderr:
|
elif key.fileobj == p.stderr:
|
||||||
chunk = p.stderr.read()
|
chunk = p.stderr.read()
|
||||||
|
# TODO: avoid chunk being set multiple times!
|
||||||
|
|
||||||
if not chunk:
|
if not chunk:
|
||||||
stdout, stderr = p.communicate()
|
stdout, stderr = p.communicate()
|
||||||
|
|||||||
@ -177,11 +177,13 @@ class Connection(ConnectionBase):
|
|||||||
+ to_native(become_output)
|
+ to_native(become_output)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
chunk = None
|
||||||
for key, event in events:
|
for key, event in events:
|
||||||
if key.fileobj == p.stdout:
|
if key.fileobj == p.stdout:
|
||||||
chunk = p.stdout.read()
|
chunk = p.stdout.read()
|
||||||
elif key.fileobj == p.stderr:
|
elif key.fileobj == p.stderr:
|
||||||
chunk = p.stderr.read()
|
chunk = p.stderr.read()
|
||||||
|
# TODO: avoid chunk being set multiple times!
|
||||||
|
|
||||||
if not chunk:
|
if not chunk:
|
||||||
stdout, stderr = p.communicate()
|
stdout, stderr = p.communicate()
|
||||||
|
|||||||
@ -859,7 +859,7 @@ def _preprocess_ports(module, values):
|
|||||||
else:
|
else:
|
||||||
port_binds = len(container_ports) * [(ipaddr,)]
|
port_binds = len(container_ports) * [(ipaddr,)]
|
||||||
else:
|
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}. '
|
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?"
|
"Maybe you forgot to use square brackets ([...]) around an IPv6 address?"
|
||||||
)
|
)
|
||||||
|
|||||||
@ -499,6 +499,8 @@ class ServicesManager(BaseComposeManager):
|
|||||||
result = self.cmd_restart()
|
result = self.cmd_restart()
|
||||||
elif self.state == "absent":
|
elif self.state == "absent":
|
||||||
result = self.cmd_down()
|
result = self.cmd_down()
|
||||||
|
else:
|
||||||
|
raise AssertionError("Unexpected state")
|
||||||
|
|
||||||
result["containers"] = self.list_containers()
|
result["containers"] = self.list_containers()
|
||||||
result["images"] = self.list_images()
|
result["images"] = self.list_images()
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user