Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions libcloud/compute/drivers/equinixmetal.py
Original file line number Diff line number Diff line change
Expand Up @@ -501,8 +501,16 @@ def _to_size(self, data):
"regions": regions,
}
try:
ram = int(data["specs"]["memory"]["total"].replace("GB", "")) * 1024 # noqa
except KeyError:
factor = 1
ram_txt = data["specs"]["memory"]["total"]
if "GB" in ram_txt:
factor = 1024
ram_txt = ram_txt.replace("GB","")
elif "TB" in ram_txt:
factor = 1024 * 1024
ram_txt = ram_txt.replace("TB","")
ram = int(ram_txt) * factor
except Exception as e:
ram = None
disk = None
if data["specs"].get("drives", ""):
Expand Down