Skip to content

Commit

Permalink
Update gophercloud to 2.0 development branch
Browse files Browse the repository at this point in the history
  • Loading branch information
dtantsur committed Sep 13, 2023
1 parent c8d5941 commit 676e06a
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 21 deletions.
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ go 1.20
require (
github.com/go-logr/logr v1.2.4
github.com/google/safetext v0.0.0-20230106111101-7156a760e523
github.com/gophercloud/gophercloud v1.6.0
github.com/gophercloud/gophercloud v1.5.1-0.20230912084133-c79ed6d3b371
github.com/metal3-io/baremetal-operator/apis v0.2.0
github.com/metal3-io/baremetal-operator/pkg/hardwareutils v0.2.0
github.com/onsi/gomega v1.27.10
Expand Down Expand Up @@ -62,7 +62,7 @@ require (
golang.org/x/exp v0.0.0-20230522175609-2e198f4a06a1 // indirect
golang.org/x/net v0.14.0 // indirect
golang.org/x/oauth2 v0.5.0 // indirect
golang.org/x/sys v0.11.0 // indirect
golang.org/x/sys v0.12.0 // indirect
golang.org/x/term v0.11.0 // indirect
golang.org/x/text v0.12.0 // indirect
golang.org/x/time v0.3.0 // indirect
Expand Down
13 changes: 4 additions & 9 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,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.3.1 h1:KjJaJ9iWZ3jOFZIf1Lqf4laDRCasjl0BCmnEGxkdLb4=
github.com/google/uuid v1.3.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/gophercloud/gophercloud v1.6.0 h1:JwJN1bauRnWPba5ueWs9IluONHteXPWjjK+MvfM4krY=
github.com/gophercloud/gophercloud v1.6.0/go.mod h1:aAVqcocTSXh2vYFZ1JTvx4EQmfgzxRcNupUfxZbBNDM=
github.com/gophercloud/gophercloud v1.5.1-0.20230912084133-c79ed6d3b371 h1:/4TDrmUM3o52/9J3Pn4mZ3VP7CYiFkDKRNuWyxLkpp4=
github.com/gophercloud/gophercloud v1.5.1-0.20230912084133-c79ed6d3b371/go.mod h1:vYRGjRkTeMAwdvQFTVuPGfRWv4dc3J2QHy9H3bHD6Pc=
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.0.1 h1:U3uMjPSQEBMNp1lFxmllqCPM6P5u/Xq7Pgzkat/bFNc=
Expand Down Expand Up @@ -156,7 +156,6 @@ go.uber.org/zap v1.25.0/go.mod h1:JIAUzQIH94IC4fOJQm7gMmBJP5k7wQfdcnYdPoEXJYk=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20220829220503-c86fa9a7ed90/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20230522175609-2e198f4a06a1 h1:k/i9J1pBpvlfR+9QsetwPyERsqu1GIbi967PQMq3Ivc=
golang.org/x/exp v0.0.0-20230522175609-2e198f4a06a1/go.mod h1:V1LtkGg67GoY2N1AnLN78QLrzxkLyJw7RJb1gzOOz9w=
Expand All @@ -177,7 +176,6 @@ golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLL
golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM=
golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.14.0 h1:BONx9s002vGdD9umnlX1Po8vOZmrgH34qlHcD1MfK14=
golang.org/x/net v0.14.0/go.mod h1:PpSgVXXLK0OxS0F31C1/tv6XNguvCrnXIDrFMspZIUI=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
Expand All @@ -196,19 +194,16 @@ golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/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-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.11.0 h1:eG7RXZHdqOJ1i+0lgLgCpSXAp6M3LYlAo6osgSi0xOM=
golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.12.0 h1:CM0HF96J0hcLAwsHPJZjfdNzs0gftsLfgKt57wWHJ0o=
golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.11.0 h1:F9tnn/DA/Im8nCwm+fX+1/eBwi4qFjRT++MhtVC4ZX0=
golang.org/x/term v0.11.0/go.mod h1:zC9APTIj3jG3FdV/Ons+XE1riIZXG4aZ4GTHiPZJPIU=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.12.0 h1:k+n5B8goJNdU7hSvEtMUz3d1Q6D/XW4COJSJR6fN0mc=
golang.org/x/text v0.12.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
golang.org/x/time v0.3.0 h1:rg5rLMjNzMS1RkNLzCG38eapWhnYLFYXDXj2gOlr8j4=
Expand Down
13 changes: 7 additions & 6 deletions pkg/provisioner/ironic/hardwaredetails/hardwaredetails.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"sort"
"strings"

"github.com/gophercloud/gophercloud/openstack/baremetal/inventory"
"github.com/gophercloud/gophercloud/openstack/baremetalintrospection/v1/introspection"

metal3api "github.com/metal3-io/baremetal-operator/apis/metal3.io/v1alpha1"
Expand Down Expand Up @@ -47,7 +48,7 @@ func getVLANs(intf introspection.BaseInterfaceType) (vlans []metal3api.VLAN, vla
return
}

func getNICDetails(ifdata []introspection.InterfaceType,
func getNICDetails(ifdata []inventory.InterfaceType,
basedata map[string]introspection.BaseInterfaceType) []metal3api.NIC {
var nics []metal3api.NIC
for _, intf := range ifdata {
Expand Down Expand Up @@ -85,7 +86,7 @@ func getNICDetails(ifdata []introspection.InterfaceType,
return nics
}

func getDiskType(diskdata introspection.RootDiskType) metal3api.DiskType {
func getDiskType(diskdata inventory.RootDiskType) metal3api.DiskType {
if diskdata.Rotational {
return metal3api.HDD
}
Expand All @@ -97,7 +98,7 @@ func getDiskType(diskdata introspection.RootDiskType) metal3api.DiskType {
return metal3api.SSD
}

func getStorageDetails(diskdata []introspection.RootDiskType) []metal3api.Storage {
func getStorageDetails(diskdata []inventory.RootDiskType) []metal3api.Storage {
storage := make([]metal3api.Storage, len(diskdata))
for i, disk := range diskdata {
device := disk.Name
Expand All @@ -121,15 +122,15 @@ func getStorageDetails(diskdata []introspection.RootDiskType) []metal3api.Storag
return storage
}

func getSystemVendorDetails(vendor introspection.SystemVendorType) metal3api.HardwareSystemVendor {
func getSystemVendorDetails(vendor inventory.SystemVendorType) metal3api.HardwareSystemVendor {
return metal3api.HardwareSystemVendor{
Manufacturer: vendor.Manufacturer,
ProductName: vendor.ProductName,
SerialNumber: vendor.SerialNumber,
}
}

func getCPUDetails(cpudata *introspection.CPUType) metal3api.CPU {
func getCPUDetails(cpudata *inventory.CPUType) metal3api.CPU {
var freq float64
fmt.Sscanf(cpudata.Frequency, "%f", &freq)
freq = math.Round(freq) // Ensure freq has no fractional part
Expand All @@ -145,7 +146,7 @@ func getCPUDetails(cpudata *introspection.CPUType) metal3api.CPU {
return cpu
}

func getFirmwareDetails(firmwaredata introspection.SystemFirmwareType) metal3api.Firmware {
func getFirmwareDetails(firmwaredata inventory.SystemFirmwareType) metal3api.Firmware {
return metal3api.Firmware{
BIOS: metal3api.BIOS{
Vendor: firmwaredata.Vendor,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"reflect"
"testing"

"github.com/gophercloud/gophercloud/openstack/baremetal/inventory"
"github.com/gophercloud/gophercloud/openstack/baremetalintrospection/v1/introspection"

metal3api "github.com/metal3-io/baremetal-operator/apis/metal3.io/v1alpha1"
Expand Down Expand Up @@ -150,7 +151,7 @@ func TestGetVLANsMalformed(t *testing.T) {

func TestGetNICDetails(t *testing.T) {
nics := getNICDetails(
[]introspection.InterfaceType{
[]inventory.InterfaceType{
{
Name: "eth0",
IPV4Address: "192.0.2.1",
Expand Down Expand Up @@ -231,7 +232,7 @@ func TestGetNICDetails(t *testing.T) {

func TestGetFirmwareDetails(t *testing.T) {
// Test full (known) firmware payload
firmware := getFirmwareDetails(introspection.SystemFirmwareType{
firmware := getFirmwareDetails(inventory.SystemFirmwareType{
Vendor: "foobar",
Version: "1.2.3",
BuildDate: "2019-07-10",
Expand Down
5 changes: 3 additions & 2 deletions pkg/provisioner/ironic/inspecthardware_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"testing"
"time"

"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/stretchr/testify/assert"
Expand Down Expand Up @@ -173,7 +174,7 @@ func TestInspectHardware(t *testing.T) {
Finished: true,
}).
WithIntrospectionData(nodeUUID, introspection.Data{
Inventory: introspection.InventoryType{
Inventory: inventory.InventoryType{
Hostname: "node-0",
},
}),
Expand Down Expand Up @@ -232,7 +233,7 @@ func TestInspectHardware(t *testing.T) {
Finished: true,
}).
WithIntrospectionData(nodeUUID, introspection.Data{
Inventory: introspection.InventoryType{
Inventory: inventory.InventoryType{
Hostname: "node-0",
},
}),
Expand Down

0 comments on commit 676e06a

Please sign in to comment.