Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision
Loading items

Target

Select target project
  • wizards/ship-cat
1 result
Select Git revision
Loading items
Show changes
Commits on Source (2)
kam-shipcat (0.9.1) unstable; urgency=medium
* Added podman_create_options and "shc update --no-pull".
-- Martin Mares <mj@ucw.cz> Tue, 18 Jun 2024 10:46:23 +0200
kam-shipcat (0.9) unstable; urgency=medium
* Initial release.
......
......@@ -12,3 +12,6 @@ allowed_groups = []
# Do we re-create the container on every start?
create_on_start = false
# Extra options passed to "podman create"
podman_create_options = []
......@@ -6,7 +6,7 @@ from grp import getgrnam
from pathlib import Path
import re
import tomllib
from typing import Set
from typing import Set, List
from .json_walker import Walker, WalkerError
......@@ -58,6 +58,7 @@ class ContainerConfig:
allowed_groups: Set[int]
create_on_start: bool
global_config: GlobalConfig
podman_create_options: List[str]
# Automatically generated
pid_file: str
......@@ -118,6 +119,7 @@ class ContainerConfig:
self.allowed_groups.add(grp.gr_gid)
self.create_on_start = w['create_on_start'].as_bool(self.global_config.default_create_on_start)
self.podman_create_options = [o.as_str() for o in w['podman_create_options'].default_to([]).array_values()]
self.pid_file = f'/run/shc/{self.name}.pid'
self.user_name = self.name
......
......@@ -192,6 +192,7 @@ def service_action(cc: ContainerConfig, action: str) -> None:
def cmd_update(args: argparse.Namespace) -> None:
cc = setup_container(args, False)
if not args.no_pull:
progress('Pulling new image')
run_command(
['podman', 'pull', cc.image]
......@@ -226,8 +227,7 @@ def create_container(cc: ContainerConfig) -> None:
'--ip', ip,
'--subuidname', cc.user_name,
'--subgidname', cc.user_name,
cc.image,
],
] + cc.podman_create_options + [cc.image]
)
......@@ -441,6 +441,7 @@ def main() -> None:
update_parser = subparsers.add_parser('update', help='update a container from an image', description='Update a container from an image and start it.')
update_parser.add_argument('name', help='name of the container')
update_parser.add_argument('--no-pull', default=False, action='store_true', help='do not pull a new image')
args = parser.parse_args()
get_caller_credentials()
......