Skip to content

Commit

Permalink
replace gophercloud/utils with go-bits/gophercloudext
Browse files Browse the repository at this point in the history
This also removes support for policy.yaml files because no YAML parser
is supplied to TokenValidator.LoadPolicyFile().
  • Loading branch information
majewsky committed Nov 11, 2024
1 parent ff55041 commit f4aa469
Show file tree
Hide file tree
Showing 48 changed files with 194 additions and 24,241 deletions.
6 changes: 1 addition & 5 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,13 @@ require (
github.com/go-gorp/gorp/v3 v3.1.0
github.com/gofrs/uuid/v5 v5.3.0
github.com/gophercloud/gophercloud/v2 v2.2.0
github.com/gophercloud/utils/v2 v2.0.0-20241107125844-da754bc75cd6
github.com/gorilla/mux v1.8.1
github.com/majewsky/schwift/v2 v2.0.0
github.com/prometheus/client_golang v1.20.5
github.com/prometheus/common v0.60.1
github.com/rs/cors v1.11.1
github.com/sapcc/go-api-declarations v1.12.9
github.com/sapcc/go-bits v0.0.0-20241107000306-6eb1626e14d0
github.com/sapcc/go-bits v0.0.0-20241111142343-42fa891b5aae
go.uber.org/automaxprocs v1.6.0
gopkg.in/yaml.v2 v2.4.0
)
Expand All @@ -31,7 +30,6 @@ require (
github.com/json-iterator/go v1.1.12 // indirect
github.com/klauspost/compress v1.17.9 // indirect
github.com/lib/pq v1.10.9 // indirect
github.com/mitchellh/go-homedir v1.1.0 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
Expand All @@ -41,7 +39,5 @@ require (
github.com/sergi/go-diff v1.3.1 // indirect
go.uber.org/atomic v1.11.0 // indirect
golang.org/x/sys v0.26.0 // indirect
golang.org/x/text v0.19.0 // indirect
google.golang.org/protobuf v1.34.2 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
8 changes: 2 additions & 6 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,6 @@ github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeN
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
github.com/gophercloud/gophercloud/v2 v2.2.0 h1:STqqnSXuhcg1OPBOZ14z6JDm8fKIN13H2bJg6bBuHp8=
github.com/gophercloud/gophercloud/v2 v2.2.0/go.mod h1:f2hMRC7Kakbv5vM7wSGHrIPZh6JZR60GVHryJlF/K44=
github.com/gophercloud/utils/v2 v2.0.0-20241107125844-da754bc75cd6 h1:Vikb1i71pW5yb/ayp+Cw6Z3Wc+3NtT+ui/t4LyJl7dY=
github.com/gophercloud/utils/v2 v2.0.0-20241107125844-da754bc75cd6/go.mod h1:9KHhEdDkA/4hTdwxS0sALJIp2hFSjrODlKMQcFU2GFw=
github.com/gorilla/mux v1.8.1 h1:TuBL49tXwgrFYWhqrNgrUNEY92u81SPhu7sTdzQEiWY=
github.com/gorilla/mux v1.8.1/go.mod h1:AKf9I4AEqPTmMytcMc0KkNouC66V3BtZ4qD5fmWSiMQ=
github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
Expand Down Expand Up @@ -102,8 +100,6 @@ github.com/mattn/go-sqlite3 v1.14.6/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A
github.com/mattn/go-sqlite3 v1.14.22 h1:2gZY6PC6kBnID23Tichd1K+Z0oS6nE/XwU+Vz/5o4kU=
github.com/mattn/go-sqlite3 v1.14.22/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxUwlHK0RXw+Y=
github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y=
github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0=
github.com/moby/docker-image-spec v1.3.1 h1:jMKff3w6PgbfSa69GfNg+zN/XLhfXJGnEx3Nl2EsFP0=
github.com/moby/docker-image-spec v1.3.1/go.mod h1:eKmb5VW8vQEh/BAr2yvVNvuiJuY6UIocYsFu/DxxRpo=
github.com/moby/term v0.5.0 h1:xt8Q1nalod/v7BqbG21f8mQPqH+xAaC9C3N3wfWbVP0=
Expand Down Expand Up @@ -163,8 +159,8 @@ github.com/rs/cors v1.11.1 h1:eU3gRzXLRK57F5rKMGMZURNdIG4EoAmX8k94r9wXWHA=
github.com/rs/cors v1.11.1/go.mod h1:XyqrcTp5zjWr1wsJ8PIRZssZ8b/WMcMf71DJnit4EMU=
github.com/sapcc/go-api-declarations v1.12.9 h1:4CWkt333oQxGnbka1TH4qApC0bxZe+WIBduygEcxiNw=
github.com/sapcc/go-api-declarations v1.12.9/go.mod h1:83R3hTANhuRXt/pXDby37IJetw8l7DG41s33Tp9NXxI=
github.com/sapcc/go-bits v0.0.0-20241107000306-6eb1626e14d0 h1:4dDWf8AxpL1FGLrAAsTSSX0K7wB9Zkti2WxTj6xvGzQ=
github.com/sapcc/go-bits v0.0.0-20241107000306-6eb1626e14d0/go.mod h1:edzu9ZBNooNFNX1J70nkhV2cOibYvADvr4C39K0stbc=
github.com/sapcc/go-bits v0.0.0-20241111142343-42fa891b5aae h1:35NZnnix3DricZDP0lCO9kziioZWJd3TPlIvFWYoUuc=
github.com/sapcc/go-bits v0.0.0-20241111142343-42fa891b5aae/go.mod h1:P4F8aMHla5I0gRW+eOEYrhM89h3heEg0nypTZZcKoBQ=
github.com/sergi/go-diff v1.3.1 h1:xkr+Oxo4BOQKmkn/B9eMK0g5Kg/983T9DqqPHwYqD+8=
github.com/sergi/go-diff v1.3.1/go.mod h1:aMJSSKb2lpPvRNec0+w3fl7LP9IOFzdc9Pa4NFbPK1I=
github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
Expand Down
2 changes: 1 addition & 1 deletion internal/api/core.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ func NewTokenValidator(provider *gophercloud.ProviderClient, eo gophercloud.Endp
IdentityV3: identityV3,
Cacher: gopherpolicy.InMemoryCacher(),
}
err = tv.LoadPolicyFile(osext.GetenvOrDefault("LIMES_API_POLICY_PATH", "/etc/limes/policy.yaml"))
err = tv.LoadPolicyFile(osext.GetenvOrDefault("LIMES_API_POLICY_PATH", "/etc/limes/policy.yaml"), nil)
return &tv, err
}

Expand Down
18 changes: 3 additions & 15 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,14 @@ import (

"github.com/dlmiddlecote/sqlstats"
"github.com/gophercloud/gophercloud/v2"
"github.com/gophercloud/gophercloud/v2/openstack"
"github.com/gophercloud/utils/v2/openstack/clientconfig"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/promhttp"
"github.com/rs/cors"
"github.com/sapcc/go-api-declarations/bininfo"
"github.com/sapcc/go-api-declarations/limes"
"github.com/sapcc/go-api-declarations/liquid"
"github.com/sapcc/go-bits/errext"
"github.com/sapcc/go-bits/gophercloudext"
"github.com/sapcc/go-bits/httpapi"
"github.com/sapcc/go-bits/httpapi/pprofapi"
"github.com/sapcc/go-bits/httpext"
Expand Down Expand Up @@ -143,19 +142,8 @@ func main() {
wrap.SetOverrideUserAgent(bininfo.Component(), bininfo.VersionOr("rolling"))

// connect to OpenStack
ao, err := clientconfig.AuthOptions(nil)
if err != nil {
logg.Fatal("cannot find OpenStack credentials: " + err.Error())
}
ao.AllowReauth = true
provider, err := openstack.AuthenticatedClient(ctx, *ao)
if err != nil {
logg.Fatal("cannot initialize OpenStack client: " + err.Error())
}
eo := gophercloud.EndpointOpts{
Availability: gophercloud.Availability(os.Getenv("OS_INTERFACE")),
Region: os.Getenv("OS_REGION_NAME"),
}
provider, eo, err := gophercloudext.NewProviderClient(ctx, nil)
must.Succeed(err)

// load configuration and connect to cluster
cluster, errs := core.NewClusterFromYAML(must.Return(os.ReadFile(configPath)))
Expand Down
201 changes: 0 additions & 201 deletions vendor/github.com/gophercloud/utils/v2/LICENSE

This file was deleted.

12 changes: 0 additions & 12 deletions vendor/github.com/gophercloud/utils/v2/env/env.go

This file was deleted.

Loading

0 comments on commit f4aa469

Please sign in to comment.