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

Function coreosRecipe

pixiecore/cli/quickcmd.go:254–296  ·  view source on GitHub ↗
(parent *cobra.Command)

Source from the content-addressed store, hash-verified

252}
253
254func coreosRecipe(parent *cobra.Command) {
255 versions := []string{
256 "stable",
257 "beta",
258 "alpha",
259 }
260
261 var coreosCmd = &cobra.Command{
262 Use: "coreos version",
263 Short: "Boot a CoreOS installer",
264 Long: fmt.Sprintf(`Boot a CoreOS installer for the given version (one of %s)`, strings.Join(versions, ",")),
265 Run: func(cmd *cobra.Command, args []string) {
266 if len(args) < 1 {
267 fatalf("you must specify a CoreOS version")
268 }
269 var version string
270 for _, v := range versions {
271 if args[0] == v {
272 version = v
273 break
274 }
275 }
276 if version == "" {
277 fatalf("Unknown CoreOS version %q", version)
278 }
279
280 arch, err := cmd.Flags().GetString("arch")
281 if err != nil {
282 fatalf("Error reading flag: %s", err)
283 }
284
285 kernel := fmt.Sprintf("https://%s.release.core-os.net/%s-usr/current/coreos_production_pxe.vmlinuz", version, arch)
286 initrd := fmt.Sprintf("https://%s.release.core-os.net/%s-usr/current/coreos_production_pxe_image.cpio.gz", version, arch)
287
288 fmt.Println(staticFromFlags(cmd, kernel, []string{initrd}, "").Serve())
289 },
290 }
291
292 coreosCmd.Flags().String("arch", "amd64", "CPU architecture of the CoreOS installer files")
293 serverConfigFlags(coreosCmd)
294 staticConfigFlags(coreosCmd)
295 parent.AddCommand(coreosCmd)
296}
297
298func netbootRecipe(parent *cobra.Command) {
299 var netbootCmd = &cobra.Command{

Callers 1

initFunction · 0.85

Calls 6

staticFromFlagsFunction · 0.85
serverConfigFlagsFunction · 0.85
staticConfigFlagsFunction · 0.85
fatalfFunction · 0.70
ServeMethod · 0.45
StringMethod · 0.45

Tested by

no test coverage detected