cmd: Enable always-pxe for packet.net

This option configures the machine to always PXE boot. By
default it would only PXE boot for the first time.

Signed-off-by: Rolf Neugebauer <rolf.neugebauer@docker.com>
This commit is contained in:
Rolf Neugebauer 2017-08-07 13:46:29 +01:00
parent bdc06ee30a
commit c804ff0dc1

View File

@ -65,6 +65,7 @@ func runPacket(args []string) {
projectFlag := flags.String("project-id", "", "Packet Project ID (or "+packetProjectIDVar+")")
hostNameFlag := flags.String("hostname", packetDefaultHostname, "Hostname of new instance (or "+packetHostnameVar+")")
nameFlag := flags.String("img-name", "", "Overrides the prefix used to identify the files. Defaults to [name] (or "+packetNameVar+")")
alwaysPXE := flags.Bool("always-pxe", true, "Reboot from PXE every time.")
if err := flags.Parse(args); err != nil {
log.Fatal("Unable to parse args")
}
@ -93,6 +94,7 @@ func runPacket(args []string) {
name := getStringValue(packetNameVar, *nameFlag, prefix)
osType := "custom_ipxe"
billing := "hourly"
// TODO(rn): Extract the kernel commandline from the file generated by moby build
userData := fmt.Sprintf("#!ipxe\n\ndhcp\nset base-url %s\nset kernel-params ip=dhcp nomodeset ro serial console=ttyS1,115200\nkernel ${base-url}/%s-kernel ${kernel-params}\ninitrd ${base-url}/%s-initrd.img\nboot", url, name, name)
log.Debugf("Using userData of:\n%s\n", userData)
initrdURL := fmt.Sprintf("%s/%s-initrd.img", url, name)
@ -110,6 +112,7 @@ func runPacket(args []string) {
ProjectID: projectID,
UserData: userData,
Tags: tags,
AlwaysPXE: *alwaysPXE,
}
d, _, err := client.Devices.Create(&req)
if err != nil {