Weldr: explicitly specify boot mode in AWS upload target
Explicitly specify the AMI boot mode in AWS upload target in Weldr API compose handler. The value is determined based on image type's boot mode. Signed-off-by: Tomáš Hozza <thozza@redhat.com>
This commit is contained in:
parent
403b1e4692
commit
a9b2964ea6
2 changed files with 15 additions and 0 deletions
|
|
@ -16,6 +16,7 @@ import (
|
|||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/aws/aws-sdk-go/service/ec2"
|
||||
"github.com/osbuild/osbuild-composer/internal/blueprint"
|
||||
"github.com/osbuild/osbuild-composer/internal/common"
|
||||
"github.com/osbuild/osbuild-composer/internal/distro"
|
||||
|
|
@ -998,6 +999,7 @@ func TestCompose(t *testing.T) {
|
|||
SecretAccessKey: "secretkey",
|
||||
Bucket: "clay",
|
||||
Key: "imagekey",
|
||||
BootMode: common.ToPtr(ec2.BootModeValuesUefiPreferred),
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ import (
|
|||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/aws/aws-sdk-go/service/ec2"
|
||||
"github.com/osbuild/osbuild-composer/internal/common"
|
||||
"github.com/osbuild/osbuild-composer/internal/distro"
|
||||
"github.com/sirupsen/logrus"
|
||||
|
|
@ -256,6 +257,17 @@ func uploadRequestToTarget(u uploadRequest, imageType distro.ImageType) *target.
|
|||
key = fmt.Sprintf("composer-api-%s", uuid.New().String())
|
||||
}
|
||||
t.Name = target.TargetNameAWS
|
||||
|
||||
var amiBootMode *string
|
||||
switch imageType.BootMode() {
|
||||
case distro.BOOT_HYBRID:
|
||||
amiBootMode = common.ToPtr(ec2.BootModeValuesUefiPreferred)
|
||||
case distro.BOOT_UEFI:
|
||||
amiBootMode = common.ToPtr(ec2.BootModeValuesUefi)
|
||||
case distro.BOOT_LEGACY:
|
||||
amiBootMode = common.ToPtr(ec2.BootModeValuesLegacyBios)
|
||||
}
|
||||
|
||||
t.Options = &target.AWSTargetOptions{
|
||||
Region: options.Region,
|
||||
AccessKeyID: options.AccessKeyID,
|
||||
|
|
@ -263,6 +275,7 @@ func uploadRequestToTarget(u uploadRequest, imageType distro.ImageType) *target.
|
|||
SessionToken: options.SessionToken,
|
||||
Bucket: options.Bucket,
|
||||
Key: key,
|
||||
BootMode: amiBootMode,
|
||||
}
|
||||
case *awsS3UploadSettings:
|
||||
key := options.Key
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue