Replace slice in templates with sprig substr
sprig replaces slice with a function that only operates on sprig lists. substr is required for use with strings. - Fixes: #1139 Signed-off-by: Jonathon Anderson <janderson@ciq.com>
This commit is contained in:
@@ -27,6 +27,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
`/sys/firmware/devicetree/base/serial-number`
|
`/sys/firmware/devicetree/base/serial-number`
|
||||||
- Fix `wwctl profile list -a` format when kernerargs are set
|
- Fix `wwctl profile list -a` format when kernerargs are set
|
||||||
- Fix a rendering bug in the documentation for GRUB boot support. #1132
|
- Fix a rendering bug in the documentation for GRUB boot support. #1132
|
||||||
|
- Replace slice in templates with sprig substr. #1093
|
||||||
|
|
||||||
## [4.5.0] 2024-02-08
|
## [4.5.0] 2024-02-08
|
||||||
|
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ gateway={{ $netdev.Gateway }}
|
|||||||
method=manual
|
method=manual
|
||||||
{{- $dns := "" }}
|
{{- $dns := "" }}
|
||||||
{{range $tk, $tv := $netdev.Tags -}}
|
{{range $tk, $tv := $netdev.Tags -}}
|
||||||
{{ $prefix := slice $tk 0 3 -}}
|
{{ $prefix := substr 0 3 $tk -}}
|
||||||
{{ if eq $prefix "DNS" -}}
|
{{ if eq $prefix "DNS" -}}
|
||||||
{{ $dns = print $dns $tv ";" -}}
|
{{ $dns = print $dns $tv ";" -}}
|
||||||
{{ end -}}
|
{{ end -}}
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
# Source: {{ $source }}
|
# Source: {{ $source }}
|
||||||
{{range $devname, $netdev := .NetDevs -}}
|
{{range $devname, $netdev := .NetDevs -}}
|
||||||
{{range $tk, $tv := $netdev.Tags -}}
|
{{range $tk, $tv := $netdev.Tags -}}
|
||||||
{{ $prefix := slice $tk 0 3 -}}
|
{{ $prefix := substr 0 3 $tk -}}
|
||||||
{{ if eq $prefix "DNS" -}}
|
{{ if eq $prefix "DNS" -}}
|
||||||
nameserver {{ $tv }}
|
nameserver {{ $tv }}
|
||||||
{{ end -}}
|
{{ end -}}
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ IPV6_FAILURE_FATAL=no
|
|||||||
IPV6ADDR="{{ $netdev.Ipaddr6 }}"
|
IPV6ADDR="{{ $netdev.Ipaddr6 }}"
|
||||||
{{ end -}}
|
{{ end -}}
|
||||||
{{range $tk, $tv := $netdev.Tags -}}
|
{{range $tk, $tv := $netdev.Tags -}}
|
||||||
{{ $prefix := slice $tk 0 3 -}}
|
{{ $prefix := substr 0 3 $tk -}}
|
||||||
{{ if eq $prefix "DNS" -}}
|
{{ if eq $prefix "DNS" -}}
|
||||||
{{ $tk }}={{ $tv }}
|
{{ $tk }}={{ $tv }}
|
||||||
{{ end -}}
|
{{ end -}}
|
||||||
|
|||||||
@@ -13,14 +13,14 @@ Requisite=ignition-ww4-disks.service
|
|||||||
{{- $prefix := $fsdevice }}
|
{{- $prefix := $fsdevice }}
|
||||||
{{- $prefix = replace "-" "\\x2d" $fsdevice }}
|
{{- $prefix = replace "-" "\\x2d" $fsdevice }}
|
||||||
{{- $prefix = replace "/" "-" $prefix }}
|
{{- $prefix = replace "/" "-" $prefix }}
|
||||||
{{- $prefix = slice $prefix 1 }}{{ $suffix := "mount" }}
|
{{- $prefix = substr 1 -1 $prefix }}{{ $suffix := "mount" }}
|
||||||
{{- if eq $fs.Format "swap"}}
|
{{- if eq $fs.Format "swap"}}
|
||||||
{{- $prefix = replace "/dev/disk/by-partlabel/" "dev-disk-by\\x2dpartlabel-" $fsdevice }}{{ $suffix = "swap"}}
|
{{- $prefix = replace "/dev/disk/by-partlabel/" "dev-disk-by\\x2dpartlabel-" $fsdevice }}{{ $suffix = "swap"}}
|
||||||
{{- else }}
|
{{- else }}
|
||||||
{{- if ne $fs.Path "" }}
|
{{- if ne $fs.Path "" }}
|
||||||
{{- $prefix = replace "-" "\\x2d" $fs.Path }}
|
{{- $prefix = replace "-" "\\x2d" $fs.Path }}
|
||||||
{{- $prefix = replace "/" "-" $prefix }}
|
{{- $prefix = replace "/" "-" $prefix }}
|
||||||
{{- $prefix = slice $prefix 1 }}
|
{{- $prefix = substr 1 -1 $prefix }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
Wants={{ print $prefix "." $suffix }}
|
Wants={{ print $prefix "." $suffix }}
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
{{- range $fsdevice,$fs := .FileSystems }}
|
{{- range $fsdevice,$fs := .FileSystems }}
|
||||||
{{- $prefix := replace "-" "\\x2d" $fs.Path }}
|
{{- $prefix := replace "-" "\\x2d" $fs.Path }}
|
||||||
{{- $prefix = replace "/" "-" $prefix }}
|
{{- $prefix = replace "/" "-" $prefix }}
|
||||||
{{- $prefix = slice $prefix 1 }}
|
{{- $prefix = substr 1 -1 $prefix }}
|
||||||
{{ $suffix := "mount"}}
|
{{ $suffix := "mount"}}
|
||||||
{{- if $fs.Label }}{{ $prefix = $fs.Label }}{{ end }}
|
{{- if $fs.Label }}{{ $prefix = $fs.Label }}{{ end }}
|
||||||
{{- if eq $fs.Format "swap" }}{{ $prefix = replace "/dev/disk/by-partlabel/" "dev-disk-by\\x2dpartlabel-" $fsdevice }}{{ $suffix = "swap" }}{{ end }}
|
{{- if eq $fs.Format "swap" }}{{ $prefix = replace "/dev/disk/by-partlabel/" "dev-disk-by\\x2dpartlabel-" $fsdevice }}{{ $suffix = "swap" }}{{ end }}
|
||||||
|
|||||||
Reference in New Issue
Block a user