generate: container: Update Network.from_json and Environment.command
Signed-off-by: Enno Tensing <tenno@suij.in>
This commit is contained in:
parent
ec61600b87
commit
2476d72192
1 changed files with 5 additions and 4 deletions
|
@ -382,7 +382,7 @@ class Environment:
|
|||
"""Option for podman container create."""
|
||||
if len(self.variables) == 0:
|
||||
return ""
|
||||
return f"--env-file={self.file}"
|
||||
return f"\t--env-file={self.file} \\\n"
|
||||
|
||||
def create(self) -> str:
|
||||
"""Create env file."""
|
||||
|
@ -480,10 +480,12 @@ class Network:
|
|||
return cls("", [])
|
||||
mode = maybe(val, "mode")
|
||||
options = maybe(val, "options")
|
||||
if mode is None or options is None or not isinstance(options, list):
|
||||
if mode is None:
|
||||
err = "Network configuration is missing or has malformed elements!"
|
||||
logger.log_error(err)
|
||||
return cls("", [])
|
||||
if options is None or not isinstance(options, list):
|
||||
return cls(str(mode), [])
|
||||
return cls(str(mode), options)
|
||||
|
||||
def command(self) -> str:
|
||||
|
@ -689,8 +691,7 @@ class Container:
|
|||
cmd += f"{self.network.command()}"
|
||||
cmd += f"{self.dns.command()}"
|
||||
cmd += f"{self.ports.command()}"
|
||||
if self.env is not None:
|
||||
cmd += f"\t{self.env.command()} \\\n"
|
||||
cmd += f"{self.env.command()}"
|
||||
for secret in self.secrets:
|
||||
cmd += f"\t{secret.command()} \\\n"
|
||||
for volume in self.volumes:
|
||||
|
|
Loading…
Add table
Reference in a new issue