Skip to content

Commit f01168c

Browse files
committed
bib: fix AWS upload with empty target-arch
This commit fixes the issue that with an unset --target-arch the code will try to convert an empty string to an arch.Arch which then fails. This is a regression from #1017 that was not caught. Closes: #1029
1 parent 3c842b2 commit f01168c

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

bib/cmd/bootc-image-builder/main.go

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -386,9 +386,13 @@ func handleAWSFlags(cmd *cobra.Command) (cloud.Uploader, error) {
386386
}
387387

388388
// check as many permission prerequisites as possible before starting
389-
targetArch, err := arch.FromString(targetArchStr)
390-
if err != nil {
391-
return nil, err
389+
targetArch := arch.Current()
390+
if targetArchStr != "" {
391+
var err error
392+
targetArch, err = arch.FromString(targetArchStr)
393+
if err != nil {
394+
return nil, err
395+
}
392396
}
393397
uploaderOpts := &awscloud.UploaderOptions{
394398
TargetArch: targetArch,

bib/cmd/upload/main.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,12 @@ func uploadAMI(cmd *cobra.Command, args []string) {
3333
targetArchStr, err := flags.GetString("target-arch")
3434
check(err)
3535

36-
targetArch, err := arch.FromString(targetArchStr)
37-
check(err)
36+
targetArch := arch.Current()
37+
if targetArchStr != "" {
38+
var err error
39+
targetArch, err = arch.FromString(targetArchStr)
40+
check(err)
41+
}
3842
opts := &awscloud.UploaderOptions{
3943
TargetArch: targetArch,
4044
}

0 commit comments

Comments
 (0)