MCPcopy Create free account
hub / github.com/danderson/netboot / expandCmdline

Function expandCmdline

pixiecore/pixiecore.go:98–112  ·  view source on GitHub ↗
(tpl string, funcs template.FuncMap)

Source from the content-addressed store, hash-verified

96}
97
98func expandCmdline(tpl string, funcs template.FuncMap) (string, error) {
99 tmpl, err := template.New("cmdline").Option("missingkey=error").Funcs(funcs).Parse(tpl)
100 if err != nil {
101 return "", fmt.Errorf("parsing cmdline %q: %s", tpl, err)
102 }
103 var out bytes.Buffer
104 if err = tmpl.Execute(&out, nil); err != nil {
105 return "", fmt.Errorf("expanding cmdline template %q: %s", tpl, err)
106 }
107 cmdline := strings.TrimSpace(out.String())
108 if strings.Contains(cmdline, "\n") {
109 return "", fmt.Errorf("cmdline %q contains a newline", cmdline)
110 }
111 return cmdline, nil
112}
113
114// A Booter provides boot instructions and files for machines.
115//

Callers 3

ipxeScriptFunction · 0.85
StaticBooterFunction · 0.85
BootSpecMethod · 0.85

Calls 1

StringMethod · 0.45

Tested by

no test coverage detected