Skip to content

Commit 509b324

Browse files
committed
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 <troglobit@gmail.com>
1 parent 71fcf0e commit 509b324

File tree

1 file changed

+2
-12
lines changed

1 file changed

+2
-12
lines changed

src/confd/src/infix-containers.c

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -38,16 +38,6 @@ static int add(const char *name, struct lyd_node *cif)
3838
char script[strlen(name) + 5];
3939
FILE *fp, *ap;
4040

41-
/*
42-
* If running already, disable the service, keeping the created
43-
* container and any volumes for later if the user re-enables
44-
* it again.
45-
*/
46-
if (!lydx_is_enabled(cif, "enabled")) {
47-
systemf("initctl -bnq disable container@%s.conf", name);
48-
return 0;
49-
}
50-
5141
snprintf(script, sizeof(script), "%s.sh", name);
5242
fp = fopenf("w", "%s/%s", _PATH_CONT, script);
5343
if (!fp) {
@@ -256,9 +246,9 @@ static int add(const char *name, struct lyd_node *cif)
256246
fchmod(fileno(fp), 0700);
257247
fclose(fp);
258248

259-
/* Enable, or update, container -- both trigger container setup. */
260-
systemf("initctl -bnq enable container@%s.conf", name);
261249
systemf("initctl -bnq touch container@%s.conf", name);
250+
systemf("initctl -bnq %s container@%s.conf", lydx_is_enabled(cif, "enabled")
251+
? "enable" : "disable", name);
262252

263253
return 0;
264254
}

0 commit comments

Comments
 (0)