Skip to content

Commit

Permalink
fix(cloudinit): wrap gateway6 in quotation marks (#79)
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasl0st authored Jan 24, 2024
1 parent 0ea3ac1 commit 830e386
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 25 deletions.
6 changes: 3 additions & 3 deletions pkg/cloudinit/network.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const (
- {{ $element.IPAddress }}
{{- end }}
{{- if and $element.IPV6Address (not $element.DHCP6)}}
- {{ $element.IPV6Address }}
- '{{ $element.IPV6Address }}'
{{- end }}
routes:
{{- if and $element.Gateway (not $element.DHCP4) }}
Expand All @@ -47,14 +47,14 @@ const (
{{- end }}
{{- if and $element.Gateway6 (not $element.DHCP6) }}
- to: '::/0'
via: {{ $element.Gateway6 }}
via: '{{ $element.Gateway6 }}'
{{- end }}
{{- end }}
{{- if $element.DNSServers }}
nameservers:
addresses:
{{- range $element.DNSServers }}
- {{ . }}
- '{{ . }}'
{{- end -}}
{{- end -}}
{{- end -}}`
Expand Down
44 changes: 22 additions & 22 deletions pkg/cloudinit/network_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ const (
via: 10.10.10.1
nameservers:
addresses:
- 8.8.8.8
- 8.8.4.4`
- '8.8.8.8'
- '8.8.4.4'`

expectedValidNetworkConfigWithoutDNS = `network:
version: 2
Expand Down Expand Up @@ -74,8 +74,8 @@ const (
via: 10.10.10.1
nameservers:
addresses:
- 8.8.8.8
- 8.8.4.4
- '8.8.8.8'
- '8.8.4.4'
eth1:
match:
macaddress: b4:87:18:bf:a3:60
Expand All @@ -88,8 +88,8 @@ const (
via: 196.168.100.254
nameservers:
addresses:
- 8.8.8.8
- 8.8.4.4`
- '8.8.8.8'
- '8.8.4.4'`

expectedValidNetworkConfigDualStack = `network:
version: 2
Expand All @@ -102,16 +102,16 @@ const (
dhcp6: false
addresses:
- 10.10.10.12/24
- 2001:db8::1/64
- '2001:db8::1/64'
routes:
- to: 0.0.0.0/0
via: 10.10.10.1
- to: '::/0'
via: 2001:db8::1
via: '2001:db8::1'
nameservers:
addresses:
- 8.8.8.8
- 8.8.4.4`
- '8.8.8.8'
- '8.8.4.4'`

expectedValidNetworkConfigIPV6 = `network:
version: 2
Expand All @@ -123,14 +123,14 @@ const (
dhcp4: false
dhcp6: false
addresses:
- 2001:db8::1/64
- '2001:db8::1/64'
routes:
- to: '::/0'
via: 2001:db8::1
via: '2001:db8::1'
nameservers:
addresses:
- 8.8.8.8
- 8.8.4.4`
- '8.8.8.8'
- '8.8.4.4'`

expectedValidNetworkConfigDHCP = `network:
version: 2
Expand All @@ -143,8 +143,8 @@ const (
dhcp6: true
nameservers:
addresses:
- 8.8.8.8
- 8.8.4.4`
- '8.8.8.8'
- '8.8.4.4'`

expectedValidNetworkConfigDHCP4 = `network:
version: 2
Expand All @@ -157,8 +157,8 @@ const (
dhcp6: false
nameservers:
addresses:
- 8.8.8.8
- 8.8.4.4`
- '8.8.8.8'
- '8.8.4.4'`

expectedValidNetworkConfigDHCP6 = `network:
version: 2
Expand All @@ -171,8 +171,8 @@ const (
dhcp6: true
nameservers:
addresses:
- 8.8.8.8
- 8.8.4.4`
- '8.8.8.8'
- '8.8.4.4'`

expectedValidNetworkConfigWithDHCP = `network:
version: 2
Expand All @@ -190,8 +190,8 @@ const (
via: 10.10.10.1
nameservers:
addresses:
- 8.8.8.8
- 8.8.4.4`
- '8.8.8.8'
- '8.8.4.4'`
)

func TestNetworkConfig_Render(t *testing.T) {
Expand Down

0 comments on commit 830e386

Please sign in to comment.