generate: container: Add command section to image configuration
Signed-off-by: Enno Tensing <tenno@suij.in>
This commit is contained in:
parent
fb6aadb63c
commit
486a38440f
1 changed files with 5 additions and 1 deletions
|
@ -506,6 +506,7 @@ class Image:
|
||||||
registry: str
|
registry: str
|
||||||
image: str
|
image: str
|
||||||
tag: str
|
tag: str
|
||||||
|
cmd: str
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def from_json(cls, val: ConfigValue, logger: Log) -> Self | None:
|
def from_json(cls, val: ConfigValue, logger: Log) -> Self | None:
|
||||||
|
@ -516,10 +517,13 @@ class Image:
|
||||||
registry = maybe_or(val, "registry", "")
|
registry = maybe_or(val, "registry", "")
|
||||||
image = maybe_or(val, "image", "")
|
image = maybe_or(val, "image", "")
|
||||||
tag = maybe_or(val, "tag", "")
|
tag = maybe_or(val, "tag", "")
|
||||||
return cls(str(registry), str(image), str(tag))
|
cmd = maybe_or(val, "command", "")
|
||||||
|
return cls(str(registry), str(image), str(tag), cmd)
|
||||||
|
|
||||||
def command(self) -> str:
|
def command(self) -> str:
|
||||||
"""Option for podman container create."""
|
"""Option for podman container create."""
|
||||||
|
if self.cmd != "":
|
||||||
|
return f"{self.registry}/{self.image}:{self.tag} {self.cmd}"
|
||||||
return f"{self.registry}/{self.image}:{self.tag}"
|
return f"{self.registry}/{self.image}:{self.tag}"
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue