diff --git a/builder/osc/bsusurrogate/builder_acc_test.go b/builder/osc/bsusurrogate/builder_acc_test.go index 5fccd79ef..00afeb182 100644 --- a/builder/osc/bsusurrogate/builder_acc_test.go +++ b/builder/osc/bsusurrogate/builder_acc_test.go @@ -27,7 +27,7 @@ const testBuilderAccBasic = ` "type": "test", "region": "eu-west-2", "vm_type": "m3.medium", - "source_omi": "ami-76b2a71e", + "source_omi": "ami-46260446", "ssh_username": "ubuntu", "omi_name": "packer-test {{timestamp}}", "omi_virtualization_type": "hvm", diff --git a/builder/osc/common/step_pre_validate.go b/builder/osc/common/step_pre_validate.go index 2d74d9e7c..1b31232aa 100644 --- a/builder/osc/common/step_pre_validate.go +++ b/builder/osc/common/step_pre_validate.go @@ -38,7 +38,17 @@ func (s *StepPreValidate) Run(_ context.Context, state multistep.StateBag) multi return multistep.ActionHalt } - if len(resp.OK.Images) > 0 { + //FIXME: Remove when the oAPI filters works + images := make([]oapi.Image, 0) + + for _, omi := range resp.OK.Images { + if omi.ImageName == s.DestOmiName { + images = append(images, omi) + } + } + + //if len(resp.OK.Images) > 0 { + if len(images) > 0 { err := fmt.Errorf("Error: name conflicts with an existing OMI: %s", resp.OK.Images[0].ImageId) state.Put("error", err) ui.Error(err.Error())