-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
69 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
package main | ||
|
||
import ( | ||
"github.com/metal-stack/go-hal" | ||
"github.com/urfave/cli/v2" | ||
) | ||
|
||
var bootCmd = &cli.Command{ | ||
Name: "boot", | ||
Usage: "gather and modify boot order", | ||
Flags: flags, | ||
Action: func(ctx *cli.Context) error { | ||
log.Warnw("getting boot order missing") | ||
return nil | ||
}, | ||
Subcommands: []*cli.Command{ | ||
{ | ||
Name: "hdd", | ||
Usage: "boot from hdd", | ||
Flags: flags, | ||
Action: func(ctx *cli.Context) error { | ||
c, err := getHalConnection(log) | ||
if err != nil { | ||
return err | ||
} | ||
err = c.BootFrom(hal.BootTargetDisk) | ||
if err != nil { | ||
return err | ||
} | ||
log.Infow("boot", "set to", hal.BootTargetDisk.String()) | ||
return nil | ||
}, | ||
}, | ||
{ | ||
Name: "pxe", | ||
Usage: "boot from pxe", | ||
Flags: flags, | ||
Action: func(ctx *cli.Context) error { | ||
c, err := getHalConnection(log) | ||
if err != nil { | ||
return err | ||
} | ||
err = c.BootFrom(hal.BootTargetPXE) | ||
if err != nil { | ||
return err | ||
} | ||
log.Infow("boot", "set to", hal.BootTargetPXE.String()) | ||
return nil | ||
}, | ||
}, | ||
{ | ||
Name: "bios", | ||
Usage: "boot to bios", | ||
Flags: flags, | ||
Action: func(ctx *cli.Context) error { | ||
c, err := getHalConnection(log) | ||
if err != nil { | ||
return err | ||
} | ||
err = c.BootFrom(hal.BootTargetBIOS) | ||
if err != nil { | ||
return err | ||
} | ||
log.Infow("boot", "set to", hal.BootTargetBIOS.String()) | ||
return nil | ||
}, | ||
}, | ||
}, | ||
} |