Ignore any duplicates being returned by the pricing API when rebuilding machine types

This commit is contained in:
Ripta Pasay 2018-11-08 08:07:57 +00:00
parent c2d82abd88
commit aa34956560
1 changed files with 6 additions and 0 deletions

View File

@ -153,6 +153,7 @@ func run() error {
}
}
seen := map[string]bool{}
for _, item := range prices {
for k, v := range item {
if k == "product" {
@ -162,6 +163,11 @@ func run() error {
attributes[k] = v.(string)
}
if _, ok := seen[attributes["instanceType"]]; ok {
continue
}
seen[attributes["instanceType"]] = true
machine := awsup.AWSMachineTypeInfo{
Name: attributes["instanceType"],
Cores: stringToInt(attributes["vcpu"]),