Fix arguments passing when reincarnating.
This commit is contained in:
parent
9164c02a3e
commit
2e005bd48e
|
@ -94,7 +94,7 @@ def setup(args: cli.Args):
|
|||
model.Project.ensure()
|
||||
print(f"Reincarnating into pod '{pod[len(podPrefix) :]}'...")
|
||||
try:
|
||||
strippedArgsV = list(sys.argv[1])
|
||||
strippedArgsV = list(sys.argv[1:])
|
||||
strippedArgsV = [arg for arg in strippedArgsV if not arg.startswith("--pod=")]
|
||||
|
||||
shell.exec(
|
||||
|
@ -148,7 +148,7 @@ def _(args: cli.Args):
|
|||
except docker.errors.NotFound:
|
||||
pass
|
||||
|
||||
print(f"Staring pod '{name[len(podPrefix) :]}'...")
|
||||
print(f"Starting pod '{name[len(podPrefix) :]}'...")
|
||||
|
||||
container = client.containers.run(
|
||||
image.image,
|
||||
|
@ -180,10 +180,20 @@ def _(args: cli.Args):
|
|||
def _(args: cli.Args):
|
||||
client = docker.from_env()
|
||||
name = str(args.consumeOpt("name", defaultPodName))
|
||||
all = args.consumeOpt("all", False) is True
|
||||
if not name.startswith(podPrefix):
|
||||
name = f"{podPrefix}{name}"
|
||||
|
||||
try:
|
||||
if all:
|
||||
for container in client.containers.list(all=True):
|
||||
if not container.name.startswith(podPrefix):
|
||||
continue
|
||||
container.stop()
|
||||
container.remove()
|
||||
print(f"Pod '{container.name[len(podPrefix) :]}' killed")
|
||||
return
|
||||
|
||||
container = client.containers.get(name)
|
||||
container.stop()
|
||||
container.remove()
|
||||
|
|
|
@ -31,13 +31,15 @@ class Uname:
|
|||
|
||||
def uname() -> Uname:
|
||||
un = platform.uname()
|
||||
|
||||
|
||||
if hasattr(platform, "freedesktop_os_release"):
|
||||
distrib = platform.freedesktop_os_release()
|
||||
else:
|
||||
distrib = {"NAME": "Unknown"}
|
||||
|
||||
result = Uname(un.system, distrib['NAME'], un.node, un.release, un.version, un.machine)
|
||||
result = Uname(
|
||||
un.system, distrib["NAME"], un.node, un.release, un.version, un.machine
|
||||
)
|
||||
|
||||
match result.machine:
|
||||
case "aarch64":
|
||||
|
@ -65,7 +67,7 @@ def find(
|
|||
if isinstance(path, list):
|
||||
for p in path:
|
||||
result += find(p, wildcards, recusive)
|
||||
return result
|
||||
return sorted(result)
|
||||
|
||||
if not os.path.isdir(path):
|
||||
return []
|
||||
|
@ -90,7 +92,8 @@ def find(
|
|||
result.append(os.path.join(path, f))
|
||||
break
|
||||
|
||||
return result
|
||||
# sort for reproducibility
|
||||
return sorted(result)
|
||||
|
||||
|
||||
def mkdir(path: str) -> str:
|
||||
|
|
Loading…
Reference in a new issue