diff --git a/cmd/image-builder/upload.go b/cmd/image-builder/upload.go index da03cf1..4e46ce2 100644 --- a/cmd/image-builder/upload.go +++ b/cmd/image-builder/upload.go @@ -89,6 +89,16 @@ func uploaderForCmdAWS(cmd *cobra.Command, bootMode *platform.BootMode) (cloud.U if err != nil { return nil, err } + if bootMode == nil { + // If unset, default to BOOT_HYBIRD which translated + // to "uefi-prefered" when registering the image. + // This should give us wide compatibility. Ideally + // we would introspect the image but we have no + // metadata there right now. + // XXX: move this into the "images" library itself? + bootModeHybrid := platform.BOOT_HYBRID + bootMode = &bootModeHybrid + } var missing []string requiredArgs := []string{"aws-ami-name", "aws-bucket", "aws-region"} @@ -126,8 +136,6 @@ func cmdUpload(cmd *cobra.Command, args []string) error { } imagePath := args[0] - // XXX: we need a way to introspect the image for bootmode here - // and/or error if no bootmode is specified uploader, err := uploaderFor(cmd, uploadTo, nil) if err != nil { return err diff --git a/cmd/image-builder/upload_test.go b/cmd/image-builder/upload_test.go index 995de24..e75c8e2 100644 --- a/cmd/image-builder/upload_test.go +++ b/cmd/image-builder/upload_test.go @@ -92,7 +92,8 @@ func TestUploadWithAWSMock(t *testing.T) { assert.Equal(t, regionName, "aws-region-1") assert.Equal(t, bucketName, "aws-bucket-2") assert.Equal(t, amiName, "aws-ami-3") - assert.Equal(t, &awscloud.UploaderOptions{TargetArch: tc.expectedUploadArch}, uploadOpts) + expectedBootMode := platform.BOOT_HYBRID + assert.Equal(t, &awscloud.UploaderOptions{TargetArch: tc.expectedUploadArch, BootMode: &expectedBootMode}, uploadOpts) assert.Equal(t, 0, fa.checkCalls) assert.Equal(t, 1, fa.uploadAndRegisterCalls)