summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Golle2020-11-22 04:23:29 +0000
committerDaniel Golle2020-11-22 23:04:09 +0000
commitd4d78dbe5ebe02d30e0cdf6f9ae85af4407b357d (patch)
treef231b284da02da84b33beb3e8fb205248aa180e9
parentdf7fa7bae605e865c5ab2b80461a4ccbbbfc1fab (diff)
downloadprocd-d4d78dbe5ebe02d30e0cdf6f9ae85af4407b357d.tar.gz
uxc: also delete procd runtime state on 'delete'
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
-rw-r--r--uxc.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/uxc.c b/uxc.c
index 5809b6d..eb40eb2 100644
--- a/uxc.c
+++ b/uxc.c
@@ -640,6 +640,8 @@ static int uxc_delete(char *name, bool force)
{
struct blob_attr *cur, *tb[__CONF_MAX];
struct runtime_state *s = NULL;
+ static struct blob_buf req;
+ uint32_t id;
int rem, ret = 0;
bool found = false;
char *fname;
@@ -678,6 +680,22 @@ static int uxc_delete(char *name, bool force)
}
}
+ if (s) {
+ ret = ubus_lookup_id(ctx, "container", &id);
+ if (ret)
+ goto errout;
+
+ blob_buf_init(&req, 0);
+ blobmsg_add_string(&req, "name", s->container_name);
+ blobmsg_add_string(&req, "instance", s->instance_name);
+
+ if (ubus_invoke(ctx, id, "delete", req.head, NULL, NULL, 3000)) {
+ blob_buf_free(&req);
+ ret=EIO;
+ goto errout;
+ }
+ }
+
if (stat(fname, &sb) == -1) {
ret=ENOENT;
goto errout;