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

Function staticFromFlags

pixiecore/cli/cli.go:98–130  ·  view source on GitHub ↗
(cmd *cobra.Command, kernel string, initrds []string, extraCmdline string)

Source from the content-addressed store, hash-verified

96}
97
98func staticFromFlags(cmd *cobra.Command, kernel string, initrds []string, extraCmdline string) *pixiecore.Server {
99 cmdline, err := cmd.Flags().GetString("cmdline")
100 if err != nil {
101 fatalf("Error reading flag: %s", err)
102 }
103 bootmsg, err := cmd.Flags().GetString("bootmsg")
104 if err != nil {
105 fatalf("Error reading flag: %s", err)
106 }
107
108 if extraCmdline != "" {
109 cmdline = fmt.Sprintf("%s %s", extraCmdline, cmdline)
110 }
111
112 spec := &pixiecore.Spec{
113 Kernel: pixiecore.ID(kernel),
114 Cmdline: cmdline,
115 Message: bootmsg,
116 }
117 for _, initrd := range initrds {
118 spec.Initrd = append(spec.Initrd, pixiecore.ID(initrd))
119 }
120
121 booter, err := pixiecore.StaticBooter(spec)
122 if err != nil {
123 fatalf("Couldn't make static booter: %s", err)
124 }
125
126 s := serverFromFlags(cmd)
127 s.Booter = booter
128
129 return s
130}
131
132func serverFromFlags(cmd *cobra.Command) *pixiecore.Server {
133 debug, err := cmd.Flags().GetBool("debug")

Callers 7

debianRecipeFunction · 0.85
ubuntuRecipeFunction · 0.85
fedoraRecipeFunction · 0.85
centosRecipeFunction · 0.85
coreosRecipeFunction · 0.85
netbootRecipeFunction · 0.85
archRecipeFunction · 0.85

Calls 4

IDTypeAlias · 0.92
StaticBooterFunction · 0.92
serverFromFlagsFunction · 0.85
fatalfFunction · 0.70

Tested by

no test coverage detected