Skip to content

Commit

Permalink
don't allow single_instance services to be detached
Browse files Browse the repository at this point in the history
  • Loading branch information
rkm committed Nov 23, 2023
1 parent e9a8853 commit f3ea136
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions roles/10-service-software/templates/bin/_smi_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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 = (
Expand Down

0 comments on commit f3ea136

Please sign in to comment.