Rename systemd templates in the ignition overlay for clarity
Signed-off-by: Jonathon Anderson <janderson@ciq.com>
This commit is contained in:
@@ -17,8 +17,8 @@ func Test_ignitionOverlay(t *testing.T) {
|
||||
output string
|
||||
isJson bool
|
||||
}{
|
||||
"ignition:ww4-disks.target": {
|
||||
args: []string{"--quiet", "--render", "node1", "ignition", "etc/systemd/system/ww4-disks.target.ww"},
|
||||
"ignition:ww-ignition-disks.target": {
|
||||
args: []string{"--quiet", "--render", "node1", "ignition", "etc/systemd/system/ww-ignition-disks.target.ww"},
|
||||
nodesConf: `
|
||||
nodes:
|
||||
node1:
|
||||
@@ -44,17 +44,17 @@ nodes:
|
||||
[Unit]
|
||||
Description=mount ww4 disks
|
||||
# make sure that the disks are available
|
||||
Requires=ignition-ww4-disks.service
|
||||
After=ignition-ww4-disks.service
|
||||
Requisite=ignition-ww4-disks.service
|
||||
Requires=ww-ignition.service
|
||||
After=ww-ignition.service
|
||||
Requisite=ww-ignition.service
|
||||
# Get the mounts
|
||||
Wants=scratch.mount
|
||||
Wants=dev-disk-by\x2dpartlabel-swap.swap
|
||||
`,
|
||||
isJson: false,
|
||||
},
|
||||
"ignition:ww4-disks.target (resources)": {
|
||||
args: []string{"--quiet", "--render", "node1", "ignition", "etc/systemd/system/ww4-disks.target.ww"},
|
||||
"ignition:ww-ignition-disks.target (resources)": {
|
||||
args: []string{"--quiet", "--render", "node1", "ignition", "etc/systemd/system/ww-ignition-disks.target.ww"},
|
||||
nodesConf: `
|
||||
nodes:
|
||||
node1:
|
||||
@@ -83,17 +83,17 @@ nodes:
|
||||
[Unit]
|
||||
Description=mount ww4 disks
|
||||
# make sure that the disks are available
|
||||
Requires=ignition-ww4-disks.service
|
||||
After=ignition-ww4-disks.service
|
||||
Requisite=ignition-ww4-disks.service
|
||||
Requires=ww-ignition.service
|
||||
After=ww-ignition.service
|
||||
Requisite=ww-ignition.service
|
||||
# Get the mounts
|
||||
Wants=scratch.mount
|
||||
Wants=dev-disk-by\x2dpartlabel-swap.swap
|
||||
`,
|
||||
isJson: false,
|
||||
},
|
||||
"ignition:ww4-mounts": {
|
||||
args: []string{"--quiet=false", "--render", "node1", "ignition", "etc/systemd/system/ww4-mounts.ww"},
|
||||
"ignition:ignition.mount": {
|
||||
args: []string{"--quiet=false", "--render", "node1", "ignition", "etc/systemd/system/ignition.mount.ww"},
|
||||
nodesConf: `
|
||||
nodes:
|
||||
node1:
|
||||
@@ -124,8 +124,8 @@ Filename: scratch.mount
|
||||
[Unit]
|
||||
ConditionPathExists=/warewulf/ignition.json
|
||||
Before=local-fs.target
|
||||
Requires=ignition-ww4-disks.service
|
||||
After=ignition-ww4-disks.service
|
||||
Requires=ww-ignition.service
|
||||
After=ww-ignition.service
|
||||
[Mount]
|
||||
Where=/scratch
|
||||
What=/dev/disk/by-partlabel/scratch
|
||||
@@ -133,25 +133,11 @@ Type=btrfs
|
||||
Options=nondefault
|
||||
[Install]
|
||||
RequiredBy=local-fs.target
|
||||
backupFile: true
|
||||
writeFile: true
|
||||
Filename: dev-disk-by\x2dpartlabel-swap.swap
|
||||
# This file is autogenerated by warewulf
|
||||
|
||||
[Unit]
|
||||
ConditionPathExists=/warewulf/ignition.json
|
||||
Requires=ignition-ww4-disks.service
|
||||
After=ignition-ww4-disks.service
|
||||
Before=swap.target
|
||||
[Swap]
|
||||
What=/dev/disk/by-partlabel/swap
|
||||
[Install]
|
||||
RequiredBy=swap.target
|
||||
`,
|
||||
isJson: false,
|
||||
},
|
||||
"ignition:ww4-mounts (resources)": {
|
||||
args: []string{"--quiet=false", "--render", "node1", "ignition", "etc/systemd/system/ww4-mounts.ww"},
|
||||
"ignition:ignition.mount (resources)": {
|
||||
args: []string{"--quiet=false", "--render", "node1", "ignition", "etc/systemd/system/ignition.mount.ww"},
|
||||
nodesConf: `
|
||||
nodes:
|
||||
node1:
|
||||
@@ -184,23 +170,52 @@ Filename: scratch.mount
|
||||
[Unit]
|
||||
ConditionPathExists=/warewulf/ignition.json
|
||||
Before=local-fs.target
|
||||
Requires=ignition-ww4-disks.service
|
||||
After=ignition-ww4-disks.service
|
||||
Requires=ww-ignition.service
|
||||
After=ww-ignition.service
|
||||
[Mount]
|
||||
Where=/scratch
|
||||
What=/dev/disk/by-partlabel/scratch
|
||||
Type=btrfs
|
||||
[Install]
|
||||
RequiredBy=local-fs.target
|
||||
backupFile: true
|
||||
`,
|
||||
isJson: false,
|
||||
},
|
||||
"ignition:ignition.swap (resources)": {
|
||||
args: []string{"--quiet=false", "--render", "node1", "ignition", "etc/systemd/system/ignition.swap.ww"},
|
||||
nodesConf: `
|
||||
nodes:
|
||||
node1:
|
||||
resources:
|
||||
ignition:
|
||||
storage:
|
||||
disks:
|
||||
- device: /dev/vda
|
||||
wipeTable: true
|
||||
partitions:
|
||||
scratch:
|
||||
shouldExist: true
|
||||
swap:
|
||||
number: 1
|
||||
sizeMiB: 1024
|
||||
filesystems:
|
||||
- device: /dev/disk/by-partlabel/scratch
|
||||
format: btrfs
|
||||
path: /scratch
|
||||
wipeFilesystem: true
|
||||
- device: /dev/disk/by-partlabel/swap
|
||||
format: swap
|
||||
path: swap`,
|
||||
output: `backupFile: true
|
||||
writeFile: true
|
||||
Filename: dev-disk-by\x2dpartlabel-swap.swap
|
||||
|
||||
# This file is autogenerated by warewulf
|
||||
|
||||
[Unit]
|
||||
ConditionPathExists=/warewulf/ignition.json
|
||||
Requires=ignition-ww4-disks.service
|
||||
After=ignition-ww4-disks.service
|
||||
Requires=ww-ignition.service
|
||||
After=ww-ignition.service
|
||||
Before=swap.target
|
||||
[Swap]
|
||||
What=/dev/disk/by-partlabel/swap
|
||||
@@ -325,8 +340,9 @@ nodes:
|
||||
t.Run(name, func(t *testing.T) {
|
||||
env := testenv.New(t)
|
||||
defer env.RemoveAll()
|
||||
env.ImportFile("var/lib/warewulf/overlays/ignition/rootfs/etc/systemd/system/ww4-disks.target.ww", "../rootfs/etc/systemd/system/ww4-disks.target.ww")
|
||||
env.ImportFile("var/lib/warewulf/overlays/ignition/rootfs/etc/systemd/system/ww4-mounts.ww", "../rootfs/etc/systemd/system/ww4-mounts.ww")
|
||||
env.ImportFile("var/lib/warewulf/overlays/ignition/rootfs/etc/systemd/system/ww-ignition-disks.target.ww", "../rootfs/etc/systemd/system/ww-ignition-disks.target.ww")
|
||||
env.ImportFile("var/lib/warewulf/overlays/ignition/rootfs/etc/systemd/system/ignition.mount.ww", "../rootfs/etc/systemd/system/ignition.mount.ww")
|
||||
env.ImportFile("var/lib/warewulf/overlays/ignition/rootfs/etc/systemd/system/ignition.swap.ww", "../rootfs/etc/systemd/system/ignition.swap.ww")
|
||||
env.ImportFile("var/lib/warewulf/overlays/ignition/rootfs/warewulf/ignition.json.ww", "../rootfs/warewulf/ignition.json.ww")
|
||||
env.WriteFile("etc/warewulf/nodes.conf", tt.nodesConf)
|
||||
cmd := show.GetCommand()
|
||||
|
||||
@@ -1,27 +1,15 @@
|
||||
{{- if .FileSystems }}
|
||||
{{- range $fsdevice, $fs := .FileSystems }}
|
||||
{{- if eq $fs.Format "swap" }}
|
||||
{{ file (print ($fsdevice | SystemdEscapePath) ".swap") }}
|
||||
# This file is autogenerated by warewulf
|
||||
|
||||
[Unit]
|
||||
ConditionPathExists=/warewulf/ignition.json
|
||||
Requires=ignition-ww4-disks.service
|
||||
After=ignition-ww4-disks.service
|
||||
Before=swap.target
|
||||
[Swap]
|
||||
What={{ $fsdevice }}
|
||||
[Install]
|
||||
RequiredBy=swap.target
|
||||
{{- else if ne $fs.Path "" }}
|
||||
{{- if ne $fs.Format "swap" }}
|
||||
{{- if ne $fs.Path "" }}
|
||||
{{ file (print ($fs.Path | SystemdEscapePath) ".mount") }}
|
||||
# This file is autogenerated by warewulf
|
||||
|
||||
[Unit]
|
||||
ConditionPathExists=/warewulf/ignition.json
|
||||
Before=local-fs.target
|
||||
Requires=ignition-ww4-disks.service
|
||||
After=ignition-ww4-disks.service
|
||||
Requires=ww-ignition.service
|
||||
After=ww-ignition.service
|
||||
[Mount]
|
||||
Where={{ $fs.Path }}
|
||||
What={{ $fsdevice }}
|
||||
@@ -31,34 +19,21 @@ Options={{ $fs.MountOptions }}
|
||||
{{- end }}
|
||||
[Install]
|
||||
RequiredBy=local-fs.target
|
||||
{{- else }}
|
||||
{{- continue }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- else if .Resources.ignition.storage.filesystems }}
|
||||
{{- range $fs := .Resources.ignition.storage.filesystems }}
|
||||
{{- if eq $fs.format "swap" }}
|
||||
{{ file (print ($fs.device | SystemdEscapePath) ".swap") }}
|
||||
# This file is autogenerated by warewulf
|
||||
|
||||
[Unit]
|
||||
ConditionPathExists=/warewulf/ignition.json
|
||||
Requires=ignition-ww4-disks.service
|
||||
After=ignition-ww4-disks.service
|
||||
Before=swap.target
|
||||
[Swap]
|
||||
What={{ $fs.device }}
|
||||
[Install]
|
||||
RequiredBy=swap.target
|
||||
{{- else if ne $fs.path "" }}
|
||||
{{- if ne $fs.format "swap" }}
|
||||
{{- if ne $fs.path "" }}
|
||||
{{ file (print ($fs.path | SystemdEscapePath) ".mount") }}
|
||||
# This file is autogenerated by warewulf
|
||||
|
||||
[Unit]
|
||||
ConditionPathExists=/warewulf/ignition.json
|
||||
Before=local-fs.target
|
||||
Requires=ignition-ww4-disks.service
|
||||
After=ignition-ww4-disks.service
|
||||
Requires=ww-ignition.service
|
||||
After=ww-ignition.service
|
||||
[Mount]
|
||||
Where={{ $fs.path }}
|
||||
What={{ $fs.device }}
|
||||
@@ -68,8 +43,7 @@ Options={{ $fs.mountOptions | join "." }}
|
||||
{{- end }}
|
||||
[Install]
|
||||
RequiredBy=local-fs.target
|
||||
{{- else }}
|
||||
{{- continue }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
35
overlays/ignition/rootfs/etc/systemd/system/ignition.swap.ww
Normal file
35
overlays/ignition/rootfs/etc/systemd/system/ignition.swap.ww
Normal file
@@ -0,0 +1,35 @@
|
||||
{{- if .FileSystems }}
|
||||
{{- range $fsdevice, $fs := .FileSystems }}
|
||||
{{- if eq $fs.Format "swap" }}
|
||||
{{ file (print ($fsdevice | SystemdEscapePath) ".swap") }}
|
||||
# This file is autogenerated by warewulf
|
||||
|
||||
[Unit]
|
||||
ConditionPathExists=/warewulf/ignition.json
|
||||
Requires=ww-ignition.service
|
||||
After=ww-ignition.service
|
||||
Before=swap.target
|
||||
[Swap]
|
||||
What={{ $fsdevice }}
|
||||
[Install]
|
||||
RequiredBy=swap.target
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- else if .Resources.ignition.storage.filesystems }}
|
||||
{{- range $fs := .Resources.ignition.storage.filesystems }}
|
||||
{{- if eq $fs.format "swap" }}
|
||||
{{ file (print ($fs.device | SystemdEscapePath) ".swap") }}
|
||||
# This file is autogenerated by warewulf
|
||||
|
||||
[Unit]
|
||||
ConditionPathExists=/warewulf/ignition.json
|
||||
Requires=ww-ignition.service
|
||||
After=ww-ignition.service
|
||||
Before=swap.target
|
||||
[Swap]
|
||||
What={{ $fs.device }}
|
||||
[Install]
|
||||
RequiredBy=swap.target
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
@@ -1 +0,0 @@
|
||||
/etc/systemd/system/ignition-ww4-disks.service
|
||||
@@ -0,0 +1 @@
|
||||
../ww-ignition-disks.target
|
||||
@@ -0,0 +1 @@
|
||||
../ww-ignition.service
|
||||
@@ -1 +0,0 @@
|
||||
/etc/systemd/system/ww4-disks.target
|
||||
@@ -3,9 +3,9 @@
|
||||
[Unit]
|
||||
Description=mount ww4 disks
|
||||
# make sure that the disks are available
|
||||
Requires=ignition-ww4-disks.service
|
||||
After=ignition-ww4-disks.service
|
||||
Requisite=ignition-ww4-disks.service
|
||||
Requires=ww-ignition.service
|
||||
After=ww-ignition.service
|
||||
Requisite=ww-ignition.service
|
||||
# Get the mounts
|
||||
{{- if .FileSystems }}
|
||||
{{- range $fsdevice, $fs := .FileSystems }}
|
||||
Reference in New Issue
Block a user