Skip to content

Commit

Permalink
export mustParseTPL for use with firewall-controller (#91)
Browse files Browse the repository at this point in the history
  • Loading branch information
majst01 authored Dec 8, 2022
1 parent 2b795b7 commit 1af0408
Show file tree
Hide file tree
Showing 14 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion pkg/netconf/frr.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (

const (
// FRRVersion holds a string that is used in the frr.conf to define the FRR version.
FRRVersion = "7.5"
FRRVersion = "8.3"
// TplFirewallFRR defines the name of the template to render FRR configuration to a 'firewall'.
TplFirewallFRR = "frr.firewall.tpl"
// TplMachineFRR defines the name of the template to render FRR configuration to a 'machine'.
Expand Down
2 changes: 1 addition & 1 deletion pkg/netconf/frr_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ func TestFrrConfigApplier(t *testing.T) {
a := NewFrrConfigApplier(test.configuratorType, *kb, "")
b := bytes.Buffer{}

tpl := mustParseTpl(test.tpl)
tpl := MustParseTpl(test.tpl)
err = a.Render(&b, *tpl)
assert.NoError(t, err)

Expand Down
2 changes: 1 addition & 1 deletion pkg/netconf/hostname_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ func TestNameHostname(t *testing.T) {
a := newHostnameApplier(*kb, "")
b := bytes.Buffer{}

tpl := mustParseTpl(tplHostname)
tpl := MustParseTpl(tplHostname)
err = a.Render(&b, *tpl)
assert.NoError(err)
assert.Equal(string(expected), b.String())
Expand Down
2 changes: 1 addition & 1 deletion pkg/netconf/hosts_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ func TestNewHostsApplier(t *testing.T) {
a := newHostsApplier(*kb, "")
b := bytes.Buffer{}

tpl := mustParseTpl(tplHosts)
tpl := MustParseTpl(tplHosts)
err = a.Render(&b, *tpl)
assert.NoError(err)
assert.Equal(string(expected), b.String())
Expand Down
2 changes: 1 addition & 1 deletion pkg/netconf/nftables_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ func TestCompileNftRules(t *testing.T) {
a := newNftablesConfigApplier(*kb, nil, tt.enableDNSProxy)
b := bytes.Buffer{}

tpl := mustParseTpl(TplNftables)
tpl := MustParseTpl(TplNftables)
err = a.Render(&b, *tpl)
assert.NoError(err)
assert.Equal(string(expected), b.String())
Expand Down
2 changes: 1 addition & 1 deletion pkg/netconf/service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ func TestServices(t *testing.T) {
assert.NoError(err)

b := bytes.Buffer{}
tpl := mustParseTpl(test.template)
tpl := MustParseTpl(test.template)
err = test.applier.Render(&b, *tpl)
assert.NoError(err)
assert.Equal(string(expected), b.String())
Expand Down
2 changes: 1 addition & 1 deletion pkg/netconf/template.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ func mustReadTpl(tplName string) string {
return string(contents)
}

func mustParseTpl(tplName string) *template.Template {
func MustParseTpl(tplName string) *template.Template {
s := mustReadTpl(tplName)
return template.Must(template.New(tplName).Parse(string(s)))
}
2 changes: 1 addition & 1 deletion pkg/netconf/testdata/frr.conf.firewall
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This file was auto generated for machine: 'e0ab02d2-27cd-5a5e-8efc-080ba80cf258' by app version .
# Do not edit.
frr version 7.5
frr version 8.3
frr defaults datacenter
hostname firewall
username cumulus nopassword
Expand Down
2 changes: 1 addition & 1 deletion pkg/netconf/testdata/frr.conf.firewall_dmz
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This file was auto generated for machine: 'e0ab02d2-27cd-5a5e-8efc-080ba80cf258' by app version .
# Do not edit.
frr version 7.5
frr version 8.3
frr defaults datacenter
hostname firewall
username cumulus nopassword
Expand Down
2 changes: 1 addition & 1 deletion pkg/netconf/testdata/frr.conf.firewall_dmz_app
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This file was auto generated for machine: 'e0ab02d2-27cd-5a5e-8efc-080ba80cf258' by app version .
# Do not edit.
frr version 7.5
frr version 8.3
frr defaults datacenter
hostname firewall
username cumulus nopassword
Expand Down
2 changes: 1 addition & 1 deletion pkg/netconf/testdata/frr.conf.firewall_dmz_app_storage
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This file was auto generated for machine: 'e0ab02d2-27cd-5a5e-8efc-080ba80cf258' by app version .
# Do not edit.
frr version 7.5
frr version 8.3
frr defaults datacenter
hostname firewall
username cumulus nopassword
Expand Down
2 changes: 1 addition & 1 deletion pkg/netconf/testdata/frr.conf.firewall_ipv6
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This file was auto generated for machine: 'e0ab02d2-27cd-5a5e-8efc-080ba80cf258' by app version .
# Do not edit.
frr version 7.5
frr version 8.3
frr defaults datacenter
hostname firewall
username cumulus nopassword
Expand Down
2 changes: 1 addition & 1 deletion pkg/netconf/testdata/frr.conf.firewall_shared
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This file was auto generated for machine: 'e0ab02d2-27cd-5a5e-8efc-080ba80cf258' by app version .
# Do not edit.
frr version 7.5
frr version 8.3
frr defaults datacenter
hostname firewall
username cumulus nopassword
Expand Down
2 changes: 1 addition & 1 deletion pkg/netconf/testdata/frr.conf.machine
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This file was auto generated for machine: 'e0ab02d2-27cd-5a5e-8efc-080ba80cf258' by app version .
# Do not edit.
frr version 7.5
frr version 8.3
frr defaults datacenter
hostname machine
username cumulus nopassword
Expand Down

0 comments on commit 1af0408

Please sign in to comment.