Skip to content

Commit

Permalink
Bump packer sdk and cleanup
Browse files Browse the repository at this point in the history
Signed-off-by: Prajyot-Parab <[email protected]>
  • Loading branch information
Prajyot-Parab committed Nov 30, 2023
1 parent 84178a3 commit 3f642fc
Show file tree
Hide file tree
Showing 15 changed files with 116 additions and 230 deletions.
1 change: 1 addition & 0 deletions builder/powervs/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ package powervs

import (
"context"

"github.com/hashicorp/hcl/v2/hcldec"
"github.com/hashicorp/packer-plugin-sdk/common"
"github.com/hashicorp/packer-plugin-sdk/communicator"
Expand Down
4 changes: 2 additions & 2 deletions builder/powervs/builder_acc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package powervs
import (
_ "embed"
"fmt"
"io/ioutil"
"io"
"os"
"os/exec"
"regexp"
Expand Down Expand Up @@ -40,7 +40,7 @@ func TestAccScaffoldingBuilder(t *testing.T) {
}
defer logs.Close()

logsBytes, err := ioutil.ReadAll(logs)
logsBytes, err := io.ReadAll(logs)
if err != nil {
return fmt.Errorf("Unable to read %s", logfile)
}
Expand Down
3 changes: 2 additions & 1 deletion builder/powervs/common/ssh.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@ package common

import (
"errors"
"time"

"github.com/IBM-Cloud/power-go-client/clients/instance"
"github.com/IBM-Cloud/power-go-client/power/models"
"github.com/hashicorp/packer-plugin-sdk/multistep"
"time"
)

var (
Expand Down
5 changes: 3 additions & 2 deletions builder/powervs/step_capture_instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@ package powervs
import (
"context"
"fmt"
"time"

"github.com/IBM-Cloud/power-go-client/clients/instance"
"github.com/IBM-Cloud/power-go-client/power/models"
"github.com/hashicorp/packer-plugin-sdk/multistep"
packersdk "github.com/hashicorp/packer-plugin-sdk/packer"
"github.com/ppc64le-cloud/packer-plugin-powervs/builder/powervs/common"
"time"
)

const (
Expand Down Expand Up @@ -70,7 +71,7 @@ loop:
break loop
default:
if time.Since(begin) >= CaptureJobWaitThreshold {
ui.Error(fmt.Sprintf("timed out while waiting for image to be captured"))
ui.Error("timed out while waiting for image to be captured")
return multistep.ActionHalt
}
ui.Message(fmt.Sprintf("Sleeping for %s", CaptureJobPollInterval))
Expand Down
1 change: 1 addition & 0 deletions builder/powervs/step_create_network.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package powervs
import (
"context"
"fmt"

"github.com/IBM-Cloud/power-go-client/clients/instance"
"github.com/IBM-Cloud/power-go-client/power/models"
"github.com/IBM/go-sdk-core/v5/core"
Expand Down
8 changes: 5 additions & 3 deletions builder/powervs/step_import_base_image.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ func (s *StepImageBaseImage) Run(_ context.Context, state multistep.StateBag) mu
break loop
default:
if time.Since(begin) >= JobWaitThreshold {
ui.Error(fmt.Sprintf("timed out while waiting for image to be imported"))
ui.Error("timed out while waiting for image to be imported")
return multistep.ActionHalt
}
ui.Message(fmt.Sprintf("Sleeping for %s Minutes", JobPollInterval))
Expand Down Expand Up @@ -143,7 +143,7 @@ func (s *StepImageBaseImage) Run(_ context.Context, state multistep.StateBag) mu
break loop2
default:
if time.Since(begin) >= ImageImportThreshold {
ui.Error(fmt.Sprintf("timed out while waiting for image to be imported"))
ui.Error("timed out while waiting for image to be imported")
return multistep.ActionHalt
}
ui.Message(fmt.Sprintf("Sleeping for %s Minutes", ImageImportPollInterval))
Expand All @@ -163,9 +163,11 @@ func (s *StepImageBaseImage) Run(_ context.Context, state multistep.StateBag) mu
imageRef = image
}
}
ui.Message(fmt.Sprintf("Image found with ID: %s", *imageRef.ImageID))

if imageRef != nil {
if imageRef.ImageID != nil {
ui.Message(fmt.Sprintf("Image found with ID: %s", *imageRef.ImageID))
}
state.Put("source_image", imageRef)
return multistep.ActionContinue
} else {
Expand Down
3 changes: 2 additions & 1 deletion builder/powervs/step_prepare.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@ package powervs
import (
"context"
"fmt"
"time"

"github.com/IBM-Cloud/power-go-client/clients/instance"
"github.com/IBM-Cloud/power-go-client/power/models"
"github.com/IBM/go-sdk-core/v5/core"
"github.com/hashicorp/packer-plugin-sdk/multistep"
packersdk "github.com/hashicorp/packer-plugin-sdk/packer"
"time"
)

const (
Expand Down
4 changes: 2 additions & 2 deletions datasource/powervs/data_acc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package powervs
import (
_ "embed"
"fmt"
"io/ioutil"
"io"
"os"
"os/exec"
"regexp"
Expand Down Expand Up @@ -40,7 +40,7 @@ func TestAccScaffoldingDatasource(t *testing.T) {
}
defer logs.Close()

logsBytes, err := ioutil.ReadAll(logs)
logsBytes, err := io.ReadAll(logs)
if err != nil {
return fmt.Errorf("Unable to read %s", logfile)
}
Expand Down
39 changes: 21 additions & 18 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ go 1.18
require (
github.com/IBM-Cloud/power-go-client v1.5.4
github.com/IBM/go-sdk-core/v5 v5.15.0
github.com/IBM/platform-services-go-sdk v0.54.0
github.com/IBM/platform-services-go-sdk v0.54.1
github.com/hashicorp/hcl/v2 v2.19.1
github.com/hashicorp/packer-plugin-sdk v0.4.0
github.com/hashicorp/packer-plugin-sdk v0.5.2
github.com/zclconf/go-cty v1.14.1
)

Expand All @@ -20,14 +20,16 @@ require (
github.com/Azure/go-ntlmssp v0.0.0-20200615164410-66371956d46c // indirect
github.com/ChrisTrenkamp/goxpath v0.0.0-20210404020558-97928f7e12b6 // indirect
github.com/agext/levenshtein v1.2.3 // indirect
github.com/apparentlymart/go-textseg/v13 v13.0.0 // indirect
github.com/apparentlymart/go-textseg/v15 v15.0.0 // indirect
github.com/armon/go-metrics v0.3.9 // indirect
github.com/armon/go-metrics v0.4.1 // indirect
github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 // indirect
github.com/aws/aws-sdk-go v1.44.114 // indirect
github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d // indirect
github.com/cenkalti/backoff/v3 v3.2.2 // indirect
github.com/dylanmei/iso8601 v0.1.0 // indirect
github.com/fatih/color v1.12.0 // indirect
github.com/fatih/color v1.14.1 // indirect
github.com/go-jose/go-jose/v3 v3.0.1 // indirect
github.com/go-logr/logr v1.2.4 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/go-openapi/analysis v0.21.4 // indirect
Expand All @@ -47,31 +49,31 @@ require (
github.com/gofrs/uuid v4.0.0+incompatible // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/golang/snappy v0.0.4 // indirect
github.com/google/go-cmp v0.6.0 // indirect
github.com/google/uuid v1.3.0 // indirect
github.com/googleapis/enterprise-certificate-proxy v0.2.3 // indirect
github.com/googleapis/gax-go/v2 v2.7.1 // indirect
github.com/hashicorp/consul/api v1.10.1 // indirect
github.com/hashicorp/consul/api v1.25.1 // indirect
github.com/hashicorp/errwrap v1.1.0 // indirect
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
github.com/hashicorp/go-getter/gcs/v2 v2.2.0 // indirect
github.com/hashicorp/go-getter/s3/v2 v2.2.0 // indirect
github.com/hashicorp/go-getter/v2 v2.2.0 // indirect
github.com/hashicorp/go-hclog v0.16.2 // indirect
github.com/hashicorp/go-getter/gcs/v2 v2.2.1 // indirect
github.com/hashicorp/go-getter/s3/v2 v2.2.1 // indirect
github.com/hashicorp/go-getter/v2 v2.2.1 // indirect
github.com/hashicorp/go-hclog v1.5.0 // indirect
github.com/hashicorp/go-immutable-radix v1.3.1 // indirect
github.com/hashicorp/go-multierror v1.1.1 // indirect
github.com/hashicorp/go-retryablehttp v0.7.2 // indirect
github.com/hashicorp/go-rootcerts v1.0.2 // indirect
github.com/hashicorp/go-safetemp v1.0.0 // indirect
github.com/hashicorp/go-secure-stdlib/parseutil v0.1.6 // indirect
github.com/hashicorp/go-secure-stdlib/strutil v0.1.2 // indirect
github.com/hashicorp/go-sockaddr v1.0.2 // indirect
github.com/hashicorp/go-version v1.6.0 // indirect
github.com/hashicorp/golang-lru v0.5.4 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/hashicorp/serf v0.9.5 // indirect
github.com/hashicorp/vault/api v1.1.1 // indirect
github.com/hashicorp/vault/sdk v0.2.1 // indirect
github.com/hashicorp/yamux v0.0.0-20210826001029-26ff87cf9493 // indirect
github.com/hashicorp/serf v0.10.1 // indirect
github.com/hashicorp/vault/api v1.10.0 // indirect
github.com/hashicorp/yamux v0.1.1 // indirect
github.com/jehiah/go-strftime v0.0.0-20171201141054-1d33003b3869 // indirect
github.com/jmespath/go-jmespath v0.4.0 // indirect
github.com/josharian/intern v1.0.0 // indirect
Expand All @@ -81,8 +83,8 @@ require (
github.com/mailru/easyjson v0.7.7 // indirect
github.com/masterzen/simplexml v0.0.0-20190410153822-31eea3082786 // indirect
github.com/masterzen/winrm v0.0.0-20210623064412-3b76017826b0 // indirect
github.com/mattn/go-colorable v0.1.8 // indirect
github.com/mattn/go-isatty v0.0.13 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.17 // indirect
github.com/mitchellh/go-fs v0.0.0-20180402235330-b7b9ca407fff // indirect
github.com/mitchellh/go-homedir v1.1.0 // indirect
github.com/mitchellh/go-testing-interface v1.14.1 // indirect
Expand All @@ -94,7 +96,6 @@ require (
github.com/oklog/ulid v1.3.1 // indirect
github.com/opentracing/opentracing-go v1.2.0 // indirect
github.com/packer-community/winrmcp v0.0.0-20180921211025-c76d91c1e7db // indirect
github.com/pierrec/lz4 v2.6.1+incompatible // indirect
github.com/pkg/sftp v1.13.2 // indirect
github.com/ryanuber/go-glob v1.0.0 // indirect
github.com/ugorji/go/codec v1.2.6 // indirect
Expand All @@ -104,6 +105,7 @@ require (
go.opentelemetry.io/otel v1.14.0 // indirect
go.opentelemetry.io/otel/trace v1.14.0 // indirect
golang.org/x/crypto v0.14.0 // indirect
golang.org/x/exp v0.0.0-20230321023759-10a507213a29 // indirect
golang.org/x/net v0.17.0 // indirect
golang.org/x/oauth2 v0.7.0 // indirect
golang.org/x/sys v0.13.0 // indirect
Expand All @@ -116,7 +118,8 @@ require (
google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1 // indirect
google.golang.org/grpc v1.56.3 // indirect
google.golang.org/protobuf v1.30.0 // indirect
gopkg.in/square/go-jose.v2 v2.6.0 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)

replace github.com/zclconf/go-cty => github.com/nywilken/go-cty v1.13.3 // added by packer-sdc fix as noted in github.com/hashicorp/packer-plugin-sdk/issues/187
Loading

0 comments on commit 3f642fc

Please sign in to comment.