Properly support relative paths to the SYSCONFDIR
This commit is contained in:
@@ -5,14 +5,18 @@ import (
|
||||
"path"
|
||||
"strings"
|
||||
|
||||
"github.com/hpcng/warewulf/internal/pkg/buildconfig"
|
||||
"github.com/hpcng/warewulf/internal/pkg/container"
|
||||
"github.com/hpcng/warewulf/internal/pkg/util"
|
||||
"github.com/hpcng/warewulf/internal/pkg/wwlog"
|
||||
)
|
||||
|
||||
func templateFileInclude(path string) string {
|
||||
wwlog.Printf(wwlog.DEBUG, "Including file into template: %s\n", path)
|
||||
content, err := ioutil.ReadFile(path)
|
||||
func templateFileInclude(inc string) string {
|
||||
if !strings.HasPrefix(inc, "/") {
|
||||
inc = path.Join(buildconfig.SYSCONFDIR(), "warewulf", inc)
|
||||
}
|
||||
wwlog.Printf(wwlog.DEBUG, "Including file into template: %s\n", inc)
|
||||
content, err := ioutil.ReadFile(inc)
|
||||
if err != nil {
|
||||
wwlog.Printf(wwlog.VERBOSE, "Could not include file into template: %s\n", err)
|
||||
}
|
||||
|
||||
@@ -1 +1 @@
|
||||
{{Include "/etc/warewulf/keys/ssh_host_dsa_key.pub"}}
|
||||
{{Include "keys/ssh_host_dsa_key.pub"}}
|
||||
|
||||
@@ -1 +1 @@
|
||||
{{Include "/etc/warewulf/keys/ssh_host_dsa_key"}}
|
||||
{{Include "keys/ssh_host_dsa_key"}}
|
||||
|
||||
@@ -1 +1 @@
|
||||
{{Include "/etc/warewulf/keys/ssh_host_ecdsa_key.pub"}}
|
||||
{{Include "keys/ssh_host_ecdsa_key.pub"}}
|
||||
|
||||
@@ -1 +1 @@
|
||||
{{Include "/etc/warewulf/keys/ssh_host_ecdsa_key"}}
|
||||
{{Include "keys/ssh_host_ecdsa_key"}}
|
||||
|
||||
@@ -1 +1 @@
|
||||
{{Include "/etc/warewulf/keys/ssh_host_ed25519_key.pub"}}
|
||||
{{Include "keys/ssh_host_ed25519_key.pub"}}
|
||||
|
||||
@@ -1 +1 @@
|
||||
{{Include "/etc/warewulf/keys/ssh_host_ed25519_key"}}
|
||||
{{Include "keys/ssh_host_ed25519_key"}}
|
||||
|
||||
@@ -1 +1 @@
|
||||
{{Include "/etc/warewulf/keys/ssh_host_rsa_key.pub"}}
|
||||
{{Include "keys/ssh_host_rsa_key.pub"}}
|
||||
|
||||
@@ -1 +1 @@
|
||||
{{Include "/etc/warewulf/keys/ssh_host_rsa_key"}}
|
||||
{{Include "keys/ssh_host_rsa_key"}}
|
||||
|
||||
@@ -1 +1 @@
|
||||
{{Include "/etc/warewulf/warewulf.conf"}}
|
||||
{{Include "warewulf.conf"}}
|
||||
|
||||
Reference in New Issue
Block a user