formatted project by python-black
This commit is contained in:
+17
-4
@@ -31,8 +31,12 @@ class ComposeProject:
|
||||
def docker(self, *args: str, timeout: int = 90, env=None) -> str:
|
||||
"""Выполняет Docker-команду с ограничением времени."""
|
||||
result = subprocess.run(
|
||||
["docker", *args], cwd=ROOT, text=True, capture_output=True,
|
||||
timeout=timeout, env={**os.environ, **(env or {})},
|
||||
["docker", *args],
|
||||
cwd=ROOT,
|
||||
text=True,
|
||||
capture_output=True,
|
||||
timeout=timeout,
|
||||
env={**os.environ, **(env or {})},
|
||||
)
|
||||
if result.returncode:
|
||||
raise RuntimeError(result.stderr.strip() or result.stdout.strip())
|
||||
@@ -53,8 +57,17 @@ class ComposeProject:
|
||||
'"health":{{if .State.Health}}{{json .State.Health.Status}}{{else}}null{{end}}}'
|
||||
)
|
||||
rows = self.docker("inspect", "--format", template, *ids).splitlines()
|
||||
configured = str(self.config["services"]["api"].get("environment", {}).get("INSTANCE_ID") or "").strip()
|
||||
configured = str(
|
||||
self.config["services"]["api"].get("environment", {}).get("INSTANCE_ID")
|
||||
or ""
|
||||
).strip()
|
||||
return [
|
||||
Replica(row["id"], row["image"], configured or row["hostname"], row["running"], row["health"])
|
||||
Replica(
|
||||
row["id"],
|
||||
row["image"],
|
||||
configured or row["hostname"],
|
||||
row["running"],
|
||||
row["health"],
|
||||
)
|
||||
for row in map(json.loads, rows)
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user