From 5e23b2ac798dac3c1598e407abec3c883f87bf39 Mon Sep 17 00:00:00 2001 From: Tobias Waldekranz Date: Fri, 12 May 2023 12:13:07 +0200 Subject: [PATCH] confd: dagger: Explicitly choose order for init/exit actions Dagger's builtin fallback to bottom-up works for init, but exit should run top-down. --- src/confd/src/dagger.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/confd/src/dagger.c b/src/confd/src/dagger.c index ee271459..1f7963c5 100644 --- a/src/confd/src/dagger.c +++ b/src/confd/src/dagger.c @@ -111,10 +111,24 @@ int dagger_claim(struct dagger *d, const char *path) return -1; } - if (readdf(&d->current, "%s/current", path)) + if (readdf(&d->current, "%s/current", path)) { d->current = -1; + } else { + err = systemf("mkdir -p %s/%d/action/exit" + " && " + "ln -s ../../top-down-order %s/%d/action/exit/order", + path, d->current, path, d->current); + if (err) + return err; + } d->next = d->current + 1; + err = systemf("mkdir -p %s/%d/action/init" + " && " + "ln -s ../../bottom-up-order %s/%d/action/init/order", + path, d->next, path, d->next); + if (err) + return err; strlcpy(d->path, path, sizeof(d->path)); return 0;