diff --git a/go.mod b/go.mod index 419f273..bb3bf22 100644 --- a/go.mod +++ b/go.mod @@ -11,7 +11,7 @@ require ( github.com/prometheus/common v0.42.0 github.com/prometheus/exporter-toolkit v0.9.1 github.com/prometheus/prometheus v1.8.2-0.20210331101223-3cafc58827d1 - github.com/scaleway/scaleway-sdk-go v1.0.0-beta.13 + github.com/scaleway/scaleway-sdk-go v1.0.0-beta.14 github.com/urfave/cli/v2 v2.25.0 gopkg.in/yaml.v3 v3.0.1 ) diff --git a/go.sum b/go.sum index 93a91a5..6fd2a87 100644 --- a/go.sum +++ b/go.sum @@ -677,8 +677,8 @@ github.com/ryanuber/columnize v2.1.0+incompatible/go.mod h1:sm1tb6uqfes/u+d4ooFo github.com/samuel/go-zookeeper v0.0.0-20190923202752-2cc03de413da/go.mod h1:gi+0XIa01GRL2eRQVjQkKGqKF3SF9vZR/HnPullcV2E= github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0= github.com/scaleway/scaleway-sdk-go v1.0.0-beta.7.0.20210223165440-c65ae3540d44/go.mod h1:CJJ5VAbozOl0yEw7nHB9+7BXTJbIn6h7W+f6Gau5IP8= -github.com/scaleway/scaleway-sdk-go v1.0.0-beta.13 h1:n5J2K6g/kl/iT6mODjCoSoRBGQVmIG3aMtYbofi9kxc= -github.com/scaleway/scaleway-sdk-go v1.0.0-beta.13/go.mod h1:fCa7OJZ/9DRTnOKmxvT6pn+LPWUptQAmHF/SBJUGEcg= +github.com/scaleway/scaleway-sdk-go v1.0.0-beta.14 h1:yFl3jyaSVLNYXlnNYM5z2pagEk1dYQhfr1p20T1NyKY= +github.com/scaleway/scaleway-sdk-go v1.0.0-beta.14/go.mod h1:fCa7OJZ/9DRTnOKmxvT6pn+LPWUptQAmHF/SBJUGEcg= github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= github.com/segmentio/kafka-go v0.1.0/go.mod h1:X6itGqS9L4jDletMsxZ7Dz+JFWxM6JHfPOCvTvk+EJo= github.com/segmentio/kafka-go v0.2.0/go.mod h1:X6itGqS9L4jDletMsxZ7Dz+JFWxM6JHfPOCvTvk+EJo= diff --git a/pkg/action/discoverer.go b/pkg/action/discoverer.go index c096850..16b6a3d 100644 --- a/pkg/action/discoverer.go +++ b/pkg/action/discoverer.go @@ -25,10 +25,6 @@ var ( "allowedActions": providerPrefix + "allowed_actions", "arch": providerPrefix + "arch", "blade": providerPrefix + "blade", - "bootscriptIdentifier": providerPrefix + "bootscript_id", - "bootscriptInitrd": providerPrefix + "bootscript_initrd", - "bootscriptKernel": providerPrefix + "bootscript_kernel", - "bootscriptTitle": providerPrefix + "bootscript_title", "bootType": providerPrefix + "boot_type", "chassis": providerPrefix + "chassis", "cluster": providerPrefix + "cluster", @@ -173,10 +169,6 @@ func (d *Discoverer) getTargets(ctx context.Context) ([]*targetgroup.Group, erro locationHypervisor string locationNode string locationPlatform string - bootscriptIdentifier string - bootscriptTitle string - bootscriptKernel string - bootscriptInitrd string securityGroupIdentifier string securityGroupName string placementGroupIdentifier string @@ -196,13 +188,6 @@ func (d *Discoverer) getTargets(ctx context.Context) ([]*targetgroup.Group, erro locationPlatform = server.Location.PlatformID } - if server.Bootscript != nil { - bootscriptIdentifier = server.Bootscript.ID - bootscriptTitle = server.Bootscript.Title - bootscriptKernel = server.Bootscript.Kernel - bootscriptInitrd = server.Bootscript.Initrd - } - if server.SecurityGroup != nil { securityGroupIdentifier = server.SecurityGroup.ID securityGroupName = server.SecurityGroup.Name @@ -255,10 +240,6 @@ func (d *Discoverer) getTargets(ctx context.Context) ([]*targetgroup.Group, erro model.LabelName(Labels["node"]): model.LabelValue(locationNode), model.LabelName(Labels["platform"]): model.LabelValue(locationPlatform), model.LabelName(Labels["ipv6"]): model.LabelValue(ipv6Address), - model.LabelName(Labels["bootscriptIdentifier"]): model.LabelValue(bootscriptIdentifier), - model.LabelName(Labels["bootscriptTitle"]): model.LabelValue(bootscriptTitle), - model.LabelName(Labels["bootscriptKernel"]): model.LabelValue(bootscriptKernel), - model.LabelName(Labels["bootscriptInitrd"]): model.LabelValue(bootscriptInitrd), model.LabelName(Labels["bootType"]): model.LabelValue(server.BootType), model.LabelName(Labels["securityGroupIdentifier"]): model.LabelValue(securityGroupIdentifier), model.LabelName(Labels["securityGroupName"]): model.LabelValue(securityGroupName), diff --git a/pkg/action/server.go b/pkg/action/server.go index 948ac2a..d318209 100644 --- a/pkg/action/server.go +++ b/pkg/action/server.go @@ -4,7 +4,6 @@ import ( "context" "fmt" "io" - "io/ioutil" "net/http" "os" "os/signal" @@ -210,7 +209,7 @@ func handler(cfg *config.Config, logger log.Logger) *chi.Mux { root.Get("/sd", func(w http.ResponseWriter, r *http.Request) { w.Header().Set("Content-Type", "application/json; charset=utf-8") - content, err := ioutil.ReadFile(cfg.Target.File) + content, err := os.ReadFile(cfg.Target.File) if err != nil { level.Info(logger).Log( diff --git a/pkg/adapter/adapter.go b/pkg/adapter/adapter.go index 6e78556..81b9d28 100644 --- a/pkg/adapter/adapter.go +++ b/pkg/adapter/adapter.go @@ -19,7 +19,6 @@ import ( "context" "encoding/json" "fmt" - "io/ioutil" "os" "path/filepath" "reflect" @@ -97,7 +96,7 @@ func (a *Adapter) writeOutput() error { b, _ := json.MarshalIndent(arr, "", " ") dir, _ := filepath.Split(a.output) - tmpfile, err := ioutil.TempFile(dir, "sd-adapter") + tmpfile, err := os.CreateTemp(dir, "sd-adapter") if err != nil { return err } diff --git a/pkg/command/setup.go b/pkg/command/setup.go index 263d3a7..2f357e8 100644 --- a/pkg/command/setup.go +++ b/pkg/command/setup.go @@ -3,7 +3,6 @@ package command import ( "encoding/json" "errors" - "io/ioutil" "os" "path/filepath" "strings" @@ -56,7 +55,7 @@ func readConfig(file string, cfg *config.Config) error { return nil } - content, err := ioutil.ReadFile(file) + content, err := os.ReadFile(file) if err != nil { return err