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
  • master
1 result

Target

Select target project
  • wizards/ship-cat
1 result
Select Git revision
  • master
1 result
Show changes

Commits on Source 2

......@@ -3,3 +3,5 @@
Albireo cleanup:
- prerouting rule
- containers
podman network create static --disable-dns --subnet 172.22.0.0/16 --gateway 172.22.0.1 --ipam-driver host-local
# Example configuration of a container
# Defaults for some options can be specified in shipcat.toml.
# Image to pull
# Container image
image = "registry.ks.matfyz.cz/gimli/web-checker"
# Pull the image automatically when creating the container
pull_image = true
# Root directory where data of the container reside
root_dir = "/tmp/root"
......
......@@ -12,5 +12,8 @@ verbosity = 0
# Where to find container root: root_dir/container_name
root_dir = "/aux/containers"
# Pull the image automatically when creating the container
pull_image = true
# Do we re-create the container on every start?
create_on_start = false
......@@ -20,6 +20,7 @@ class GlobalConfig:
verbosity: int
default_root_path: Path
default_create_on_start: bool
default_pull_image: bool
@classmethod
def load(self, filename: str) -> 'GlobalConfig':
......@@ -47,6 +48,7 @@ class GlobalConfig:
with w['defaults'].enter_object() as d:
self.default_root_path = Path(d['root_dir'].as_str())
self.default_create_on_start = d['create_on_start'].as_bool(False)
self.default_pull_image = d['pull_image'].as_bool(True)
class ContainerConfig:
......@@ -54,6 +56,7 @@ class ContainerConfig:
root_path: Path
data_path: Path
image: str
pull_image: bool
allowed_users: Set[int]
allowed_groups: Set[int]
create_on_start: bool
......@@ -99,6 +102,7 @@ class ContainerConfig:
self.data_path = self.root_path / 'data'
self.image = w['image'].as_str()
self.pull_image = w['pull_image'].as_bool(self.global_config.default_pull_image)
self.allowed_users = set()
for wu in w['allowed_users'].default_to([]).array_values():
......
......@@ -192,7 +192,12 @@ 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:
if args.pull is not None:
should_pull = args.pull
else:
should_pull = cc.pull_image
if should_pull:
progress('Pulling new image')
run_command(
['podman', 'pull', cc.image]
......@@ -441,7 +446,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')
update_parser.add_argument('--pull', action=argparse.BooleanOptionalAction, help='pull a new image (use --pull or --no-pull to override behavior specified by container config) ')
args = parser.parse_args()
get_caller_credentials()
......