From d7f44c57ad01ed670b1a5849aee4769e9eaae265 Mon Sep 17 00:00:00 2001 From: psrok1 Date: Fri, 27 Sep 2024 11:53:40 +0200 Subject: [PATCH] Allow 0 in draksetup scale to disable services, don't enable first drakrun worker on draksetup postinstall --- drakrun/drakrun/draksetup/postinstall.py | 9 +++------ drakrun/drakrun/draksetup/scale.py | 6 ++++-- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/drakrun/drakrun/draksetup/postinstall.py b/drakrun/drakrun/draksetup/postinstall.py index da0e44c3..aacf5df0 100644 --- a/drakrun/drakrun/draksetup/postinstall.py +++ b/drakrun/drakrun/draksetup/postinstall.py @@ -60,9 +60,6 @@ def postinstall(generate_apivectors_profile): create_vm_profiles(generate_apivectors_profile) log.info("All right, drakrun setup is done.") - log.info("First instance of drakrun will be enabled automatically...") - subprocess.check_output("systemctl enable drakrun@1", shell=True) - subprocess.check_output("systemctl start drakrun@1", shell=True) - - log.info("If you want to have more parallel instances, execute:") - log.info(" # draksetup scale ") + log.info("If you want to enable drakrun worker, execute:") + log.info(" # draksetup scale 1") + log.info("or provide a higher number if you want to have more parallel VMs") diff --git a/drakrun/drakrun/draksetup/scale.py b/drakrun/drakrun/draksetup/scale.py index 39c028f6..156b2d29 100644 --- a/drakrun/drakrun/draksetup/scale.py +++ b/drakrun/drakrun/draksetup/scale.py @@ -12,8 +12,10 @@ @click.argument("scale_count", type=int) def scale(scale_count): """Enable or disable additional parallel instances of drakrun service..""" - if scale_count < 1: - raise RuntimeError("Invalid value of scale parameter. Must be at least 1.") + if scale_count >= 0: + raise RuntimeError( + "Invalid value of scale parameter - must be a positive number." + ) cur_services = set(list(get_enabled_drakruns())) new_services = set([f"drakrun@{i}.service" for i in range(1, scale_count + 1)])