From b66eb156bf0f7a4d1595e6fa7b46dda66db69790 Mon Sep 17 00:00:00 2001 From: Sean Whitton Date: Mon, 20 Feb 2023 10:35:06 -0700 Subject: add LXC:USER-CONTAINER-STOPPED Signed-off-by: Sean Whitton --- src/property/lxc.lisp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src/property') diff --git a/src/property/lxc.lisp b/src/property/lxc.lisp index 19b2c2d..bd4bf43 100644 --- a/src/property/lxc.lisp +++ b/src/property/lxc.lisp @@ -1,6 +1,6 @@ ;;; Consfigurator -- Lisp declarative configuration management system -;;; Copyright (C) 2021 Sean Whitton +;;; Copyright (C) 2021, 2023 Sean Whitton ;;; This file is free software; you can redistribute it and/or modify ;;; it under the terms of the GNU General Public License as published by @@ -45,6 +45,13 @@ HOST is a HOST value, start the container whose name is HOST's hostname.)" (:check (or (service:no-services-p) (user-container-active-p host owner))) (:apply (lxc-cmd owner "lxc-unpriv-start" "-n" (get-hostname host)))) +(defprop user-container-stopped :posix (host &optional owner) + "Ensure the LXC unprivileged container for the host designated by HOST owned +by OWNER, defaulting to the current user, is stopped." + (:desc #?"LXC container ${(get-hostname host)} stopped") + (:check (not (user-container-active-p host owner))) + (:apply (lxc-cmd owner "lxc-stop" "-n" (get-hostname host)))) + (defmacro when-user-container-running ((host &key owner) &body propapps) "Apply PROPAPPS only when the unprivileged LXC for the host designated by HOST and owned by OWNER, defaulting to the current user, is already started." -- cgit v1.2.3