diff --git a/builder/osc/bsusurrogate/builder.go b/builder/osc/bsusurrogate/builder.go index 0bb609fc5..711cfeba4 100644 --- a/builder/osc/bsusurrogate/builder.go +++ b/builder/osc/bsusurrogate/builder.go @@ -6,10 +6,8 @@ package bsusurrogate import ( "context" - "crypto/tls" "errors" "fmt" - "net/http" "github.com/hashicorp/hcl/v2/hcldec" osccommon "github.com/hashicorp/packer/builder/osc/common" @@ -19,7 +17,6 @@ import ( "github.com/hashicorp/packer/helper/multistep" "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/template/interpolate" - "github.com/outscale/osc-go/oapi" ) const BuilderId = "oapi.outscale.bsusurrogate" @@ -104,25 +101,11 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) { } func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (packer.Artifact, error) { - clientConfig, err := b.config.Config() - if err != nil { - return nil, err - } - - skipClient := &http.Client{ - Transport: &http.Transport{ - TLSClientConfig: &tls.Config{InsecureSkipVerify: true}, - }, - } - - oapiconn := oapi.NewClient(clientConfig, skipClient) - oscConn := b.config.NewOSCClient() // Setup the state bag and initial state for the steps state := new(multistep.BasicStateBag) state.Put("config", &b.config) - state.Put("oapi", oapiconn) state.Put("osc", oscConn) state.Put("accessConfig", &b.config.AccessConfig) state.Put("hook", hook) @@ -251,7 +234,6 @@ func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (pack artifact := &osccommon.Artifact{ Omis: omis.(map[string]string), BuilderIdValue: BuilderId, - Config: clientConfig, StateData: map[string]interface{}{"generated_data": state.Get("generated_data")}, } diff --git a/builder/osc/bsusurrogate/step_register_omi.go b/builder/osc/bsusurrogate/step_register_omi.go index 24437e3c5..3d8541df8 100644 --- a/builder/osc/bsusurrogate/step_register_omi.go +++ b/builder/osc/bsusurrogate/step_register_omi.go @@ -8,7 +8,6 @@ import ( osccommon "github.com/hashicorp/packer/builder/osc/common" "github.com/hashicorp/packer/helper/multistep" "github.com/hashicorp/packer/packer" - "github.com/outscale/osc-go/oapi" "github.com/outscale/osc-sdk-go/osc" ) @@ -23,7 +22,6 @@ type StepRegisterOMI struct { func (s *StepRegisterOMI) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { config := state.Get("config").(*Config) - oapiconn := state.Get("oapi").(*oapi.Client) oscconn := state.Get("osc").(*osc.APIClient) snapshotIds := state.Get("snapshot_ids").(map[string]string) ui := state.Get("ui").(packer.Ui) @@ -51,7 +49,7 @@ func (s *StepRegisterOMI) Run(ctx context.Context, state multistep.StateBag) mul // Set the OMI ID in the state ui.Say(fmt.Sprintf("OMI: %s", registerResp.Image.ImageId)) omis := make(map[string]string) - omis[oapiconn.GetConfig().Region] = registerResp.Image.ImageId + omis[s.RawRegion] = registerResp.Image.ImageId state.Put("omis", omis) // Wait for the image to become ready