Coverage report: /home/ellis/comp/core/lib/box/ignition.lisp
Kind | Covered | All | % |
expression | 0 | 110 | 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
;;; ignition.lisp --- CoreOS Ignition
3
;; Ignition JSON config parsing
7
;; Objects <-> SXP <-> JSON
9
;; I really have no interest in reading or writing YAML, so instead we'll read
10
;; and write lisp. This package provides the role of Butane.
12
;; ref: https://coreos.github.io/butane
14
;; currently based on the 3.6.0 (WIP)
16
;; spec: https://coreos.github.io/ignition/configuration-v3_6_experimental
21
"ignition": { "version": "3.6.0-experimental" },
24
"name": "example.service",
26
"contents": "[Service]\nType=oneshot\nExecStart=/usr/bin/echo Hello World\n\n[Install]\nWantedBy=multi-user.target"
32
(in-package :box/ignition)
34
(define-constant +ignition-version+ "3.6.0-experimental" :test 'equal)
35
(defvar *ignition-config*)
37
(defconfig ignition-config (box-config)
38
((version :initform +ignition-version+ :initarg :version)
39
(config :initarg :config)
40
(timeouts :initarg :timeouts)
41
(security :initarg :security)
42
(proxy :initarg :proxy)
43
(storage :initarg :storage)
44
(systemd :initarg :systemd)
45
(passwd :initarg :passwd)
46
(kernel-arguments :initarg :kernel-arguments)))
48
(defmethod make-config ((self (eql :ignition)) &rest args)
49
(apply 'make-instance 'ignition-config args))
51
(defmethod deserialize (self (fmt (eql :ignition)) &key)
52
(let* ((json (deserialize self :json))
53
(ignition (json-getf json "ignition"))
54
(passwd (json-getf json "passwd"))
55
(storage (json-getf json "storage"))
56
(systemd (json-getf json "systemd")))
57
(make-config :ignition
58
:version (json-getf ignition "version")
59
:config (json-getf ignition "config")
60
:security (json-getf ignition "security")
61
:proxy (json-getf ignition "proxy")
62
:timeouts (json-getf ignition "timeouts")
67
(defmethod serialize ((self ignition-config) (fmt (eql :ignition)) &key stream)
69
(make-instance 'json-object
71
`(("version" ,(slot-value self 'version))
72
,@(when (slot-boundp* self 'passwd)
73
`(("passwd" ,(slot-value self 'passwd))))
74
,@(when (slot-boundp* self 'storage)
75
`(("storage" ,(slot-value self 'storage))))
76
,@(when (slot-boundp* self 'systemd)
77
`(("systemd" ,(slot-value self 'systemd))))))
81
(defconfig ignition-config-options ()
85
(defconfig ignition-storage-config ()
93
(defconfig ignition-timeouts-config ()
94
((http-response-headers)
97
(defconfig ignition-security-config ()
100
(defconfig ignition-proxy-config ()
105
(defstruct ignition-disk device wipe-table partitions)
107
(defstruct ignition-partition label number size start)
109
(defstruct ignition-raid devices level name)
111
(defstruct ignition-filesystem device path format wipe-filesystem label)
113
(defstruct ignition-file path mode contents)
115
(defstruct ignition-file-contents source verification)
117
(defconfig ignition-systemd-config ()
120
(defstruct ignition-systemd-unit
122
(enabled nil :type boolean)
123
(mask nil :type boolean)
127
(defstruct ignition-systemd-dropin name contents)
129
(defconfig ignition-passwd-config ()
133
(defstruct ignition-user
134
name password-hash ssh-authorized-keys uid
135
gecos home-dir no-create-home primary-group
136
groups no-user-group no-log-init shell
139
(defstruct ignition-group
140
name gid password-hash should-exist system)
142
(defconfig ignition-kernel-arguments ()
143
((should-exist) (should-not-exist)))
145
(defmethods build-ast
146
(((self ignition-config) &key) (unwrap-object self)))