Coverage report: /home/ellis/comp/core/lib/pod/podman.lisp
Kind | Covered | All | % |
expression | 0 | 107 | 0.0 |
branch | 0 | 6 | 0.0 |
Key
Not instrumented
Conditionalized out
Executed
Not executed
Both branches taken
One branch taken
Neither branch taken
1
;;; lib/pod/podman.lisp --- Pod Manager
8
(defvar *podman-config-directory* (merge-homedir-pathnames ".config/containers/"))
10
(defvar *container* nil)
12
(defun check-container (&optional (c *container*))
14
(required-argument :container)))
16
(defun podman-build (&key file tag no-cache)
17
(apply 'run-podman "build"
18
`(,@(when file `("--file" ,(namestring file)))
19
,@(when tag `("--tag" ,tag))
20
,@(when no-cache `("--no-cache")))))
22
(defun podman-exec (cmd &key dir (container *container*))
23
(check-container container)
24
(apply 'run-podman "exec"
25
`(,@(when dir `("-w" ,(namestring dir)))
27
,@(if (atom cmd) `(,cmd) cmd))))
29
(defun podman-run (args &key dir (container *container*) name (tty t) (detach t) cmd (replace t) systemd ports)
32
;; mount memory hostname env
33
;; dns authfile cap cgroup
34
;; expose label log mac-address
35
;; pod publish quiet read-only
36
;; replace restart requires rm
37
;; secret systemd timeout tty
38
;; tz ulimit user volume
39
(check-container container)
40
(apply 'run-podman "exec"
41
`(,@(when dir `("-w" ,(namestring dir)))
42
,@(when name `("--name" ,name))
43
,@(when tty `("--tty" ,tty))
44
,@(when detach `("--detach" ,detach))
45
,@(when cmd `("--cmd" ,cmd))
46
,@(when replace '("--replace"))
47
,@(when ports (flatten
52
(format nil "~A:~A" (car x) (cdr x))
55
,@(when systemd '("--systemd=true"))
57
,@(if (atom args) `(,args) args))))
59
(defun podman-cp (src dst &key overwrite)
60
(apply 'run-podman "cp" `(,@(when overwrite '("--overwrite")) ,(namestring src) ,(namestring dst))))
62
(defun podman-stop (&optional (container *container*))
63
(check-container container)
64
(run-podman "stop" container))
66
(defmacro with-container ((sym container &key run stop name dir tty detach cmd)
70
,@(when dir `(:dir ,dir))
71
,@(when tty `(:dir ,tty))
72
,@(when detach `(:dir ,detach))
73
,@(when cmd `(:cmd ,cmd))
74
,@(when name `(:name ,name))
75
:container ,container)
77
(setf *container* ,sym)
79
,@(when stop `((podman-stop ,sym)))))