From f4fadbebb64b3d20e279b0a39aae2b9b3a4011a1 Mon Sep 17 00:00:00 2001 From: e-carlin Date: Mon, 5 Feb 2024 22:26:40 +0000 Subject: [PATCH] Fix #442: increase TimeoutStartSec and make configurable --- rsconf/component/vm_devbox.py | 3 ++- .../package_data/vm_devbox/vm_devbox_unit_service.jinja | 2 +- tests/pkcli/build_data/1.in/db/000.yml | 3 ++- .../srv/host/v9.radia.run/srv/vm_devbox_user-1/stop | 9 +++++++++ .../1.out/srv/host/v9.radia.run/vm_devbox_user-1.sh | 4 ++-- 5 files changed, 16 insertions(+), 5 deletions(-) create mode 100644 tests/pkcli/build_data/1.out/srv/host/v9.radia.run/srv/vm_devbox_user-1/stop diff --git a/rsconf/component/vm_devbox.py b/rsconf/component/vm_devbox.py index 3bf3654d..83b55147 100644 --- a/rsconf/component/vm_devbox.py +++ b/rsconf/component/vm_devbox.py @@ -42,6 +42,7 @@ def _create_user_instances(): z.ssh_guest_identity_pub_f = "/etc/ssh/identity.pub" z.start_f = z.run_d.join("start") z.stop_f = z.run_d.join("stop") + z.timeout_start_min = jc[self.module_name].get("timeout_start_min", 15) z.vm_hostname = f"{self._user}.{jc[self.module_name].vm_parent_domain}" systemd.unit_prepare(self, self.j2_ctx, watch_files=(z.start_f, z.stop_f)) self._network(jc, z) @@ -57,7 +58,7 @@ def internal_build_write(self): self.install_directory(z.run_d) self.install_access(mode="500", owner=z.run_u) self.install_resource("vm_devbox/start.sh", host_path=z.start_f) - self.install_resource("vm_devbox/start.sh", host_path=z.stop_f) + self.install_resource("vm_devbox/stop.sh", host_path=z.stop_f) self.install_access(mode="444", owner=jc.rsconf_db.root_u) self.install_resource( "vm_devbox/vm_devbox_unit_service", jc, jc.systemd.service_f diff --git a/rsconf/package_data/vm_devbox/vm_devbox_unit_service.jinja b/rsconf/package_data/vm_devbox/vm_devbox_unit_service.jinja index a2bf3533..6a696a4a 100644 --- a/rsconf/package_data/vm_devbox/vm_devbox_unit_service.jinja +++ b/rsconf/package_data/vm_devbox/vm_devbox_unit_service.jinja @@ -7,7 +7,7 @@ ExecStart={{ this.start_f }} ExecStop={{ this.stop_f }} Group={{ this.run_u }} SyslogIdentifier={{ systemd.service_name }} -TimeoutStartSec=10min +TimeoutStartSec={{ this.timeout_start_min }}min Type=forking User={{ this.run_u }} diff --git a/tests/pkcli/build_data/1.in/db/000.yml b/tests/pkcli/build_data/1.in/db/000.yml index 2f7267ba..1bd9c4e9 100644 --- a/tests/pkcli/build_data/1.in/db/000.yml +++ b/tests/pkcli/build_data/1.in/db/000.yml @@ -609,9 +609,10 @@ host: sirepo_test_http: on_calendar: "9:00" vm_devbox: - vm_parent_domain: radia.run + timeout_start_min: 5 users: - user-1 + vm_parent_domain: radia.run # testing named needs build-perl-rpms.sh # - bivio_named diff --git a/tests/pkcli/build_data/1.out/srv/host/v9.radia.run/srv/vm_devbox_user-1/stop b/tests/pkcli/build_data/1.out/srv/host/v9.radia.run/srv/vm_devbox_user-1/stop new file mode 100644 index 00000000..8717c88d --- /dev/null +++ b/tests/pkcli/build_data/1.out/srv/host/v9.radia.run/srv/vm_devbox_user-1/stop @@ -0,0 +1,9 @@ +#!/bin/bash +set -eou pipefail + +vm_devbox_main() { + cd /srv/vm_devbox_user-1 + vagrant halt +} + +vm_devbox_main diff --git a/tests/pkcli/build_data/1.out/srv/host/v9.radia.run/vm_devbox_user-1.sh b/tests/pkcli/build_data/1.out/srv/host/v9.radia.run/vm_devbox_user-1.sh index 28bd7e70..478ef42b 100644 --- a/tests/pkcli/build_data/1.out/srv/host/v9.radia.run/vm_devbox_user-1.sh +++ b/tests/pkcli/build_data/1.out/srv/host/v9.radia.run/vm_devbox_user-1.sh @@ -5,7 +5,7 @@ rsconf_install_access '700' 'vagrant' 'vagrant' rsconf_install_directory '/srv/vm_devbox_user-1' rsconf_install_access '500' 'vagrant' 'vagrant' rsconf_install_file '/srv/vm_devbox_user-1/start' '5dc3180f1dfd32e5d9d15e426928e94a' -rsconf_install_file '/srv/vm_devbox_user-1/stop' '5dc3180f1dfd32e5d9d15e426928e94a' +rsconf_install_file '/srv/vm_devbox_user-1/stop' '17c8ef8fe2fa06489f4e9cb5869d22b6' rsconf_install_access '444' 'root' 'root' -rsconf_install_file '/etc/systemd/system/vm_devbox_user-1.service' 'bcc048be3260244008a695125c53fc9f' +rsconf_install_file '/etc/systemd/system/vm_devbox_user-1.service' '9bea6d3fc6b169474e19863d1e2da5a3' }