genreate: container: Add accounting support to Container.create
Add support for accouting to __init__ and create. Signed-off-by: Enno Tensing <tenno@suij.in>
This commit is contained in:
parent
2a7bb0115c
commit
93245d5bc6
1 changed files with 4 additions and 0 deletions
|
@ -531,6 +531,7 @@ class Container:
|
|||
secrets: list | None
|
||||
volumes: list | None
|
||||
capabilities: list | None
|
||||
accounting: Accounting
|
||||
|
||||
def __init__(self, json: dict, logger: Log | None = None) -> None:
|
||||
"""Create from JSON."""
|
||||
|
@ -560,6 +561,7 @@ class Container:
|
|||
secrets = maybe(json, "secrets")
|
||||
volumes = maybe(json, "volumes")
|
||||
capabilities = maybe(json, "capabilities")
|
||||
accounting = maybe(json, "accounting")
|
||||
self.name = str(name)
|
||||
self.image = Image.from_json(image, logger)
|
||||
self.privileged = privileged is not None and bool(privileged)
|
||||
|
@ -576,6 +578,7 @@ class Container:
|
|||
self.secrets = Secret.from_json(secrets, logger)
|
||||
self.volumes = Volume.from_json(volumes, logger)
|
||||
self.capabilities = Capability.from_json(capabilities, logger)
|
||||
self.accounting = Accounting.from_json(accounting, logger)
|
||||
|
||||
def create_volumes(self) -> str:
|
||||
"""Generate podman volume create commands."""
|
||||
|
@ -625,6 +628,7 @@ class Container:
|
|||
cmd += f"\t{volume.command()} \\\n"
|
||||
for capability in self.capabilities:
|
||||
cmd += f"\t{capability.command()} \\\n"
|
||||
cmd += f"{self.accounting.command()}"
|
||||
cmd += f"\t{self.image.command()}\n"
|
||||
return cmd
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue