mirror of
https://github.com/prometheus/prometheus.git
synced 2025-03-05 20:59:13 -08:00
feat: add missing client opts and gofmt
Signed-off-by: Paulo Dias <paulodias.gm@gmail.com>
This commit is contained in:
parent
c60120f54b
commit
3853513ea3
|
@ -74,18 +74,18 @@ func newInstanceDiscovery(provider *gophercloud.ProviderClient, opts *gopherclou
|
|||
}
|
||||
|
||||
type SupportedFeatures struct {
|
||||
flavorOriginalName bool // Available from 2.47
|
||||
flavorOriginalName bool // Available from 2.47
|
||||
}
|
||||
|
||||
func getSupportedFeatures(minMinor, minMajor, maxMinor, maxMajor int) SupportedFeatures {
|
||||
features := SupportedFeatures{}
|
||||
features := SupportedFeatures{}
|
||||
|
||||
// Feature: 'flavor.original_name' is supported from microversion 2.47 onwards
|
||||
if maxMajor > 2 || (maxMajor == 2 && maxMinor >= 47) {
|
||||
features.flavorOriginalName = true
|
||||
}
|
||||
// Feature: 'flavor.original_name' is supported from microversion 2.47 onwards
|
||||
if maxMajor > 2 || (maxMajor == 2 && maxMinor >= 47) {
|
||||
features.flavorOriginalName = true
|
||||
}
|
||||
|
||||
return features
|
||||
return features
|
||||
}
|
||||
|
||||
func setClientMicroversion(sc *gophercloud.ServiceClient, microversion string) *gophercloud.ServiceClient {
|
||||
|
@ -197,13 +197,13 @@ func (i *InstanceDiscovery) refresh(ctx context.Context) ([]*targetgroup.Group,
|
|||
var latestServers []servers.Server
|
||||
if features.flavorOriginalName {
|
||||
// Fetch the server list using the client with the latest microversion
|
||||
allPages, err := servers.List(clientLatest, nil).AllPages(ctx)
|
||||
allPages, err := servers.List(clientLatest, opts).AllPages(ctx)
|
||||
if err != nil {
|
||||
i.logger.Warn("Failed to fetch server list with latest microversion, falling back to flavor.id:", err)
|
||||
i.logger.Warn("Failed to fetch server list with latest microversion, falling back to flavor.id")
|
||||
} else {
|
||||
latestServers, err = servers.ExtractServers(allPages)
|
||||
if err != nil {
|
||||
i.logger.Warn("Failed to extract servers with latest microversion, falling back to flavor.id:", err)
|
||||
i.logger.Warn("Failed to extract servers with latest microversion, falling back to flavor.id")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -262,7 +262,6 @@ func (i *InstanceDiscovery) refresh(ctx context.Context) ([]*targetgroup.Group,
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
imageID, ok := s.Image["id"].(string)
|
||||
if ok {
|
||||
labels[openstackLabelInstanceImage] = model.LabelValue(imageID)
|
||||
|
|
Loading…
Reference in a new issue