1
0
Fork 0

generate: container: Update methods to use {create,remove}_environment

Update Container methods to use the new {create,remove}_environment
methods.

Signed-off-by: Enno Tensing <tenno@suij.in>
This commit is contained in:
Enno Tensing 2025-07-22 13:22:38 +02:00
parent 3f5ccffc4a
commit 13cbc2f403
Signed by: tenno
GPG key ID: 95265603BD36E66C

View file

@ -476,8 +476,6 @@ class Container:
def create_container(self) -> str: def create_container(self) -> str:
"""Create podman container.""" """Create podman container."""
cmd = "" cmd = ""
if self.env is not None:
cmd += self.env.create()
cmd += self.create() cmd += self.create()
return cmd return cmd
@ -505,11 +503,13 @@ class Container:
"""Generate podman container upgrade composite command.""" """Generate podman container upgrade composite command."""
comment = f"# Upgrade container {self.name}\n" comment = f"# Upgrade container {self.name}\n"
remove_container = self.remove_container() remove_container = self.remove_container()
remove_env_file = self.env.remove() remove_env_file = self.remove_environment()
create_container = self.create_container() create_container = self.create_container()
create_env_file = self.create_environment()
start_container = self.start_container() start_container = self.start_container()
remove = f"{remove_container}\n{remove_env_file}\n" remove = f"{remove_container}\n{remove_env_file}\n"
create_and_start = create_container + "\n" + start_container create = f"{create_env_file}\n{create_container}\n"
create_and_start = create + "\n" + start_container
return f"{comment}\n{remove}\n{create_and_start}" return f"{comment}\n{remove}\n{create_and_start}"
def purge_container(self) -> str: def purge_container(self) -> str:
@ -517,9 +517,7 @@ class Container:
remove_container = self.remove_container() remove_container = self.remove_container()
remove_volumes = self.remove_volumes() remove_volumes = self.remove_volumes()
remove_secrets = self.remove_secrets() remove_secrets = self.remove_secrets()
remove_env_file = "" remove_env_file = self.remove_environment()
if self.env is not None:
remove_env_file = self.env.remove()
remove_data = f"{remove_volumes}\n{remove_secrets}\n{remove_env_file}" remove_data = f"{remove_volumes}\n{remove_secrets}\n{remove_env_file}"
return f"{remove_container}\n{remove_data}" return f"{remove_container}\n{remove_data}"