(tpl string, funcs template.FuncMap)
| 96 | } |
| 97 | |
| 98 | func 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 | // |
no test coverage detected