-
Notifications
You must be signed in to change notification settings - Fork 0
/
helper.go
36 lines (29 loc) · 926 Bytes
/
helper.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package content
import (
"io/ioutil"
"path"
"github.com/openshift/installer/data"
)
const (
// TemplateDir is the target directory for all template assets' files
TemplateDir = "templates"
bootkubeDataDir = "manifests/bootkube/"
tectonicDataDir = "manifests/tectonic/"
)
// GetBootkubeTemplate returns the contents of the file in bootkube data dir
func GetBootkubeTemplate(uri string) ([]byte, error) {
return getFileContents(path.Join(bootkubeDataDir, uri))
}
// GetTectonicTemplate returns the contents of the file in tectonic data dir
func GetTectonicTemplate(uri string) ([]byte, error) {
return getFileContents(path.Join(tectonicDataDir, uri))
}
// getFileContents the content of the given URI, assuming that it's a file
func getFileContents(uri string) ([]byte, error) {
file, err := data.Assets.Open(uri)
if err != nil {
return []byte{}, err
}
defer file.Close()
return ioutil.ReadAll(file)
}