Skip to content

Commit

Permalink
Merge pull request #1569 from dtantsur/gophercloud-2
Browse files Browse the repository at this point in the history
⚠️ Update to gophercloud 2.0.0-beta2
  • Loading branch information
metal3-io-bot authored Mar 4, 2024
2 parents b3ec0b3 + 606dc84 commit 31dcd10
Show file tree
Hide file tree
Showing 28 changed files with 77 additions and 69 deletions.
5 changes: 3 additions & 2 deletions cmd/get-hardware-details/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@
package main

import (
"context"
"encoding/json"
"fmt"
"net"
"net/url"
"os"
"strings"

"github.com/gophercloud/gophercloud/openstack/baremetal/v1/nodes"
"github.com/gophercloud/gophercloud/v2/openstack/baremetal/v1/nodes"
"k8s.io/klog/v2"

"github.com/metal3-io/baremetal-operator/pkg/provisioner/ironic/clients"
Expand Down Expand Up @@ -59,7 +60,7 @@ func main() {
os.Exit(1)
}

introData := nodes.GetInventory(ironic, opts.NodeID)
introData := nodes.GetInventory(context.TODO(), ironic, opts.NodeID)
data, err := introData.Extract()
if err != nil {
fmt.Printf("could not get inspection data: %s", err)
Expand Down
6 changes: 3 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
module github.com/metal3-io/baremetal-operator

go 1.21
go 1.21.6

require (
github.com/go-logr/logr v1.4.1
github.com/google/safetext v0.0.0-20230106111101-7156a760e523
github.com/gophercloud/gophercloud v1.5.1-0.20231117122435-08456f7fe42e
github.com/gophercloud/gophercloud/v2 v2.0.0-beta.2
github.com/metal3-io/baremetal-operator/apis v0.5.0
github.com/metal3-io/baremetal-operator/pkg/hardwareutils v0.5.0
github.com/onsi/gomega v1.31.1
Expand Down Expand Up @@ -62,7 +62,7 @@ require (
golang.org/x/exp v0.0.0-20230522175609-2e198f4a06a1 // indirect
golang.org/x/net v0.19.0 // indirect
golang.org/x/oauth2 v0.12.0 // indirect
golang.org/x/sys v0.15.0 // indirect
golang.org/x/sys v0.17.0 // indirect
golang.org/x/term v0.15.0 // indirect
golang.org/x/text v0.14.0 // indirect
golang.org/x/time v0.3.0 // indirect
Expand Down
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ github.com/google/safetext v0.0.0-20230106111101-7156a760e523 h1:i4NsbmB9pD5+Ggp
github.com/google/safetext v0.0.0-20230106111101-7156a760e523/go.mod h1:mJNEy0r5YPHC7ChQffpOszlGB4L1iqjXWpIEKcFpr9s=
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/gophercloud/gophercloud v1.5.1-0.20231117122435-08456f7fe42e h1:acHzJUXVfS+GImmi+yyM2+AOiaO94Z4KaTTFVU6Ov9U=
github.com/gophercloud/gophercloud v1.5.1-0.20231117122435-08456f7fe42e/go.mod h1:ecnaHbFxBunc2UeAONDQbkQacv6WP1syeZ02TgAB7kA=
github.com/gophercloud/gophercloud/v2 v2.0.0-beta.2 h1:JWv6L7eg3+aIS57n11YlVvtn1pVCKpVlMo24ANj/OVc=
github.com/gophercloud/gophercloud/v2 v2.0.0-beta.2/go.mod h1:Sy5GHwY4iazyaRf94rzL/VxJToVWn8WnIH+1cXqoAks=
github.com/imdario/mergo v0.3.12 h1:b6R2BslTbIEToALKP7LxUvijTsNI9TAe80pLWN2g/HU=
github.com/imdario/mergo v0.3.12/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA=
github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8=
Expand Down Expand Up @@ -165,8 +165,8 @@ golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc=
golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.17.0 h1:25cE3gD+tdBA7lp7QfhuV+rJiE9YXTcS3VG1SqssI/Y=
golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.15.0 h1:y/Oo/a/q3IXu26lQgl04j/gjuBDOBlx7X6Om1j2CPW4=
golang.org/x/term v0.15.0/go.mod h1:BDl952bC7+uMoWR75FIrCDx79TPU9oHkTZ9yRbYOrX0=
Expand Down
2 changes: 1 addition & 1 deletion pkg/provisioner/ironic/adopt_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"testing"
"time"

"github.com/gophercloud/gophercloud/openstack/baremetal/v1/nodes"
"github.com/gophercloud/gophercloud/v2/openstack/baremetal/v1/nodes"
"github.com/stretchr/testify/assert"

"github.com/metal3-io/baremetal-operator/pkg/hardwareutils/bmc"
Expand Down
2 changes: 1 addition & 1 deletion pkg/provisioner/ironic/capabilities_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package ironic
import (
"testing"

"github.com/gophercloud/gophercloud/openstack/baremetal/v1/nodes"
"github.com/gophercloud/gophercloud/v2/openstack/baremetal/v1/nodes"
"github.com/stretchr/testify/assert"

metal3api "github.com/metal3-io/baremetal-operator/apis/metal3.io/v1alpha1"
Expand Down
6 changes: 3 additions & 3 deletions pkg/provisioner/ironic/clients/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import (
"os"
"time"

"github.com/gophercloud/gophercloud"
"github.com/gophercloud/gophercloud/openstack/baremetal/httpbasic"
"github.com/gophercloud/gophercloud/openstack/baremetal/noauth"
"github.com/gophercloud/gophercloud/v2"
"github.com/gophercloud/gophercloud/v2/openstack/baremetal/httpbasic"
"github.com/gophercloud/gophercloud/v2/openstack/baremetal/noauth"
"go.etcd.io/etcd/client/pkg/v3/transport"
)

Expand Down
9 changes: 5 additions & 4 deletions pkg/provisioner/ironic/clients/features.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
package clients

import (
"context"
"fmt"

"github.com/go-logr/logr"
"github.com/gophercloud/gophercloud"
"github.com/gophercloud/gophercloud/openstack/utils"
"github.com/gophercloud/gophercloud/v2"
"github.com/gophercloud/gophercloud/v2/openstack/utils"
)

// AvailableFeatures represents features that Ironic API provides.
Expand All @@ -21,8 +22,8 @@ type AvailableFeatures struct {
// Version 1.81 allows retrival of Node inventory.
const baseline = "1.81"

func GetAvailableFeatures(client *gophercloud.ServiceClient) (features AvailableFeatures, err error) {
mvs, err := utils.GetSupportedMicroversions(client)
func GetAvailableFeatures(ctx context.Context, client *gophercloud.ServiceClient) (features AvailableFeatures, err error) {
mvs, err := utils.GetSupportedMicroversions(ctx, client)
if err != nil {
return
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/provisioner/ironic/configdrive_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package ironic
import (
"testing"

"github.com/gophercloud/gophercloud/openstack/baremetal/v1/nodes"
"github.com/gophercloud/gophercloud/v2/openstack/baremetal/v1/nodes"
"github.com/stretchr/testify/assert"

metal3api "github.com/metal3-io/baremetal-operator/apis/metal3.io/v1alpha1"
Expand Down
2 changes: 1 addition & 1 deletion pkg/provisioner/ironic/delete_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"testing"
"time"

"github.com/gophercloud/gophercloud/openstack/baremetal/v1/nodes"
"github.com/gophercloud/gophercloud/v2/openstack/baremetal/v1/nodes"
"github.com/stretchr/testify/assert"

"github.com/metal3-io/baremetal-operator/pkg/hardwareutils/bmc"
Expand Down
10 changes: 6 additions & 4 deletions pkg/provisioner/ironic/dependencies.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
package ironic

import (
"github.com/gophercloud/gophercloud/openstack/baremetal/v1/drivers"
"github.com/gophercloud/gophercloud/pagination"
"context"

"github.com/gophercloud/gophercloud/v2/openstack/baremetal/v1/drivers"
"github.com/gophercloud/gophercloud/v2/pagination"

"github.com/metal3-io/baremetal-operator/pkg/provisioner/ironic/clients"
)
Expand All @@ -11,7 +13,7 @@ import (
func (p *ironicProvisioner) TryInit() (ready bool, err error) {
p.debugLog.Info("verifying ironic provisioner dependencies")

p.availableFeatures, err = clients.GetAvailableFeatures(p.client)
p.availableFeatures, err = clients.GetAvailableFeatures(p.ctx, p.client)
if err != nil {
p.log.Info("error caught while checking endpoint, will retry", "endpoint", p.client.Endpoint, "error", err)
return false, nil
Expand All @@ -34,7 +36,7 @@ func (p *ironicProvisioner) checkIronicConductor() (ready bool, err error) {
}

driverCount := 0
pager.EachPage(func(page pagination.Page) (bool, error) {
pager.EachPage(p.ctx, func(_ context.Context, page pagination.Page) (bool, error) {
actual, driverErr := drivers.ExtractDrivers(page)
if driverErr != nil {
return false, driverErr
Expand Down
2 changes: 1 addition & 1 deletion pkg/provisioner/ironic/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"strings"

"github.com/go-logr/logr"
"github.com/gophercloud/gophercloud"
"github.com/gophercloud/gophercloud/v2"

"github.com/metal3-io/baremetal-operator/pkg/provisioner"
"github.com/metal3-io/baremetal-operator/pkg/provisioner/ironic/clients"
Expand Down
2 changes: 1 addition & 1 deletion pkg/provisioner/ironic/findhost_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package ironic
import (
"testing"

"github.com/gophercloud/gophercloud/openstack/baremetal/v1/nodes"
"github.com/gophercloud/gophercloud/v2/openstack/baremetal/v1/nodes"

"github.com/metal3-io/baremetal-operator/pkg/hardwareutils/bmc"
"github.com/metal3-io/baremetal-operator/pkg/provisioner/ironic/clients"
Expand Down
6 changes: 3 additions & 3 deletions pkg/provisioner/ironic/hardwaredetails/hardwaredetails.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import (
"strings"

"github.com/go-logr/logr"
"github.com/gophercloud/gophercloud/openstack/baremetal/inventory"
"github.com/gophercloud/gophercloud/openstack/baremetal/v1/nodes"
"github.com/gophercloud/gophercloud/openstack/baremetalintrospection/v1/introspection"
"github.com/gophercloud/gophercloud/v2/openstack/baremetal/inventory"
"github.com/gophercloud/gophercloud/v2/openstack/baremetal/v1/nodes"
"github.com/gophercloud/gophercloud/v2/openstack/baremetalintrospection/v1/introspection"

metal3api "github.com/metal3-io/baremetal-operator/apis/metal3.io/v1alpha1"
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import (
"reflect"
"testing"

"github.com/gophercloud/gophercloud/openstack/baremetal/inventory"
"github.com/gophercloud/gophercloud/openstack/baremetalintrospection/v1/introspection"
"github.com/gophercloud/gophercloud/v2/openstack/baremetal/inventory"
"github.com/gophercloud/gophercloud/v2/openstack/baremetalintrospection/v1/introspection"
"github.com/stretchr/testify/assert"

metal3api "github.com/metal3-io/baremetal-operator/apis/metal3.io/v1alpha1"
Expand Down
4 changes: 2 additions & 2 deletions pkg/provisioner/ironic/inspecthardware_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import (
"testing"
"time"

"github.com/gophercloud/gophercloud/openstack/baremetal/inventory"
"github.com/gophercloud/gophercloud/openstack/baremetal/v1/nodes"
"github.com/gophercloud/gophercloud/v2/openstack/baremetal/inventory"
"github.com/gophercloud/gophercloud/v2/openstack/baremetal/v1/nodes"
"github.com/stretchr/testify/assert"

metal3api "github.com/metal3-io/baremetal-operator/apis/metal3.io/v1alpha1"
Expand Down
Loading

0 comments on commit 31dcd10

Please sign in to comment.