From e5da7f04730ec5b756743b8e75594c23a54091a2 Mon Sep 17 00:00:00 2001 From: Joachim Wiberg Date: Tue, 9 Sep 2025 18:08:32 +0200 Subject: [PATCH] confd: create container script even if disabled Not only great for debugging, but also allows users to start their containers manually in another way. But yeah, mostly for debug. Signed-off-by: Joachim Wiberg --- src/confd/src/infix-containers.c | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/src/confd/src/infix-containers.c b/src/confd/src/infix-containers.c index 22736992..2a108109 100644 --- a/src/confd/src/infix-containers.c +++ b/src/confd/src/infix-containers.c @@ -38,16 +38,6 @@ static int add(const char *name, struct lyd_node *cif) char script[strlen(name) + 5]; FILE *fp, *ap; - /* - * If running already, disable the service, keeping the created - * container and any volumes for later if the user re-enables - * it again. - */ - if (!lydx_is_enabled(cif, "enabled")) { - systemf("initctl -bnq disable container@%s.conf", name); - return 0; - } - snprintf(script, sizeof(script), "%s.sh", name); fp = fopenf("w", "%s/%s", _PATH_CONT, script); if (!fp) { @@ -256,9 +246,9 @@ static int add(const char *name, struct lyd_node *cif) fchmod(fileno(fp), 0700); fclose(fp); - /* Enable, or update, container -- both trigger container setup. */ - systemf("initctl -bnq enable container@%s.conf", name); systemf("initctl -bnq touch container@%s.conf", name); + systemf("initctl -bnq %s container@%s.conf", lydx_is_enabled(cif, "enabled") + ? "enable" : "disable", name); return 0; }