From 35f2b956d2aba3d3a79c27c1f3544cf161488aba Mon Sep 17 00:00:00 2001
From: Martin Mares <mj@ucw.cz>
Date: Tue, 18 Jun 2024 12:09:57 +0200
Subject: [PATCH] Add "shc update --no-pull"
---
debian/changelog | 2 +-
shipcat/main.py | 10 ++++++----
2 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/debian/changelog b/debian/changelog
index 2b5c612..bdd5c1c 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,6 +1,6 @@
kam-shipcat (0.9.1) unstable; urgency=medium
- * Added podman_create_options.
+ * Added podman_create_options and "shc update --no-pull".
-- Martin Mares <mj@ucw.cz> Tue, 18 Jun 2024 10:46:23 +0200
diff --git a/shipcat/main.py b/shipcat/main.py
index e29dd64..1f46a84 100755
--- a/shipcat/main.py
+++ b/shipcat/main.py
@@ -192,10 +192,11 @@ def service_action(cc: ContainerConfig, action: str) -> None:
def cmd_update(args: argparse.Namespace) -> None:
cc = setup_container(args, False)
- progress('Pulling new image')
- run_command(
- ['podman', 'pull', cc.image]
- )
+ if not args.no_pull:
+ progress('Pulling new image')
+ run_command(
+ ['podman', 'pull', cc.image]
+ )
progress('Stopping container')
service_action(cc, 'stop')
@@ -440,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()
--
GitLab