From f3ea1368fcbf8710b65963a7010bacf198465be2 Mon Sep 17 00:00:00 2001 From: Ruairidh MacLeod Date: Thu, 23 Nov 2023 10:47:39 +0000 Subject: [PATCH] don't allow single_instance services to be detached --- roles/10-service-software/templates/bin/_smi_wrapper.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/roles/10-service-software/templates/bin/_smi_wrapper.py b/roles/10-service-software/templates/bin/_smi_wrapper.py index 1f828e5..d524877 100644 --- a/roles/10-service-software/templates/bin/_smi_wrapper.py +++ b/roles/10-service-software/templates/bin/_smi_wrapper.py @@ -3,6 +3,7 @@ import subprocess import sys + INSTALL_DIR = os.path.abspath(os.path.join(os.path.dirname(__file__), "..")) FILE_LOAD_CONFIG = "file_load_services.yaml" @@ -92,8 +93,10 @@ def run( def run_smiservices(config_name: str, single_instance: bool = False) -> None: wrapper_args, remaining_argv, env, config_dir = init() - if wrapper_args.copies > 1 and single_instance: - raise ValueError("Cannot start more than one copy of this service") + if (wrapper_args.copies > 1 or wrapper_args.detach) and single_instance: + raise ValueError( + "Cannot start more than one copy of this service, or run it detached", + ) config_path = os.path.join(config_dir, config_name) smi_bin = (