1
0
Fork 0

generate: container: Rename Container.crate to Container.create_container

Since the environemt creation are now seperate methods, the create and
create_container split is no longer needed.

Signed-off-by: Enno Tensing <tenno@suij.in>
This commit is contained in:
Enno Tensing 2025-07-22 13:34:04 +02:00
parent d67dcfd466
commit 015f2e5a16
Signed by: tenno
GPG key ID: 95265603BD36E66C

View file

@ -421,33 +421,6 @@ class Container:
self.volumes = Volume.from_json(volumes, logger)
self.capabilities = Capability.from_json(capabilities, logger)
def create(self) -> str:
"""Generate podman container create command."""
cmd = f"# Create container {self.name}"
cmd += "podman container crate \\\n"
cmd += f"\t--name={self.name} \\\n"
if self.privileged:
cmd += "\t--privileged \\\n"
if self.replace:
cmd += "\t--replace \\\n"
if self.read_only:
cmd += "\t--read-only \\\n"
cmd += f"\t--restart={self.restart} \\\n"
cmd += f"\t--pull={self.pull_policy} \\\n"
cmd += f"\t{self.network.command()} \\\n"
cmd += f"\t{self.dns.command()} \\\n"
cmd += f"{self.ports.command()}"
if self.env is not None:
cmd += f"\t{self.env.command()} \\\n"
for secret in self.secrets:
cmd += f"\t{secret.command()} \\\n"
for volume in self.volumes:
cmd += f"\t{volume.command()} \\\n"
for capability in self.capabilities:
cmd += f"\t{capability.command()} \\\n"
cmd += f"\t{self.image.command()}\n"
return cmd
def create_volumes(self) -> str:
"""Generate podman volume create commands."""
if self.volumes is None:
@ -473,9 +446,30 @@ class Container:
return self.env.create()
def create_container(self) -> str:
"""Create podman container."""
cmd = ""
cmd += self.create()
"""Generate podman container create command."""
cmd = f"# Create container {self.name}"
cmd += "podman container crate \\\n"
cmd += f"\t--name={self.name} \\\n"
if self.privileged:
cmd += "\t--privileged \\\n"
if self.replace:
cmd += "\t--replace \\\n"
if self.read_only:
cmd += "\t--read-only \\\n"
cmd += f"\t--restart={self.restart} \\\n"
cmd += f"\t--pull={self.pull_policy} \\\n"
cmd += f"\t{self.network.command()} \\\n"
cmd += f"\t{self.dns.command()} \\\n"
cmd += f"{self.ports.command()}"
if self.env is not None:
cmd += f"\t{self.env.command()} \\\n"
for secret in self.secrets:
cmd += f"\t{secret.command()} \\\n"
for volume in self.volumes:
cmd += f"\t{volume.command()} \\\n"
for capability in self.capabilities:
cmd += f"\t{capability.command()} \\\n"
cmd += f"\t{self.image.command()}\n"
return cmd
def start_container(self) -> str: