Commit 43227420 by diegolima

Ignorar instancias nao-existentes em uma regiao

1 parent 83423130
Showing with 37 additions and 35 deletions
...@@ -58,41 +58,42 @@ with open(FCATALOG) as url: ...@@ -58,41 +58,42 @@ with open(FCATALOG) as url:
cost = DATA['gcp_price_list'][product][region] cost = DATA['gcp_price_list'][product][region]
if PRODUCT_FAMILY == COMPUTE_PRODUCT_FAMILY: if PRODUCT_FAMILY == COMPUTE_PRODUCT_FAMILY:
cost = DATA['gcp_price_list'][product][region] cost = DATA['gcp_price_list'][product][region]
for os in GCE_OS: if float(cost) != 0 :
if os == 'linux': for os in GCE_OS:
add = 0 if os == 'linux':
else: add = 0
billing_cores = DATA['gcp_price_list']['CP-COMPUTEENGINE-OS'][os]["cores"] else:
billing_cpu = cpu billing_cores = DATA['gcp_price_list']['CP-COMPUTEENGINE-OS'][os]["cores"]
if billing_cores == 'shared': billing_cpu = cpu
billing_cores = 1 if billing_cores == 'shared':
if billing_cpu == 'shared': billing_cores = 1
billing_cpu = 1 if billing_cpu == 'shared':
#TODO: Make this logic elegant (use cores/shared logic) billing_cpu = 1
if 'win' in os: #TODO: Make this logic elegant (use cores/shared logic)
if 'f1-micro' in name or 'g1-small' in name: if 'win' in os:
add = float(DATA['gcp_price_list']['CP-COMPUTEENGINE-OS'][os]["low"]) if 'f1-micro' in name or 'g1-small' in name:
else: add = float(DATA['gcp_price_list']['CP-COMPUTEENGINE-OS'][os]["low"])
add = float(DATA['gcp_price_list']['CP-COMPUTEENGINE-OS'][os]["high"]) * float(billing_cpu) else:
elif 'rhel' in os: add = float(DATA['gcp_price_list']['CP-COMPUTEENGINE-OS'][os]["high"]) * float(billing_cpu)
if float(billing_cpu) <= 4: elif 'rhel' in os:
add = float(DATA['gcp_price_list']['CP-COMPUTEENGINE-OS'][os]["low"]) if float(billing_cpu) <= 4:
else: add = float(DATA['gcp_price_list']['CP-COMPUTEENGINE-OS'][os]["low"])
else:
add = float(DATA['gcp_price_list']['CP-COMPUTEENGINE-OS'][os]["high"])
elif 'suse-sap' in os:
add = float(DATA['gcp_price_list']['CP-COMPUTEENGINE-OS'][os]["high"]) add = float(DATA['gcp_price_list']['CP-COMPUTEENGINE-OS'][os]["high"])
elif 'suse-sap' in os: elif 'suse' in os:
add = float(DATA['gcp_price_list']['CP-COMPUTEENGINE-OS'][os]["high"]) if 'f1-micro' in name or 'g1-small' in name:
elif 'suse' in os: add = float(DATA['gcp_price_list']['CP-COMPUTEENGINE-OS'][os]["low"])
if 'f1-micro' in name or 'g1-small' in name: else:
add = float(DATA['gcp_price_list']['CP-COMPUTEENGINE-OS'][os]["low"]) add = float(DATA['gcp_price_list']['CP-COMPUTEENGINE-OS'][os]["high"]) * float(billing_cpu)
else: elif 'sql' in os:
add = float(DATA['gcp_price_list']['CP-COMPUTEENGINE-OS'][os]["high"]) * float(billing_cpu) if 'f1-micro' in name or 'g1-small' in name:
elif 'sql' in os: add = float(DATA['gcp_price_list']['CP-COMPUTEENGINE-OS']['win']["low"])
if 'f1-micro' in name or 'g1-small' in name: else:
add = float(DATA['gcp_price_list']['CP-COMPUTEENGINE-OS']['win']["low"]) add = float(DATA['gcp_price_list']['CP-COMPUTEENGINE-OS']['win']["high"]) * float(billing_cpu)
else: add = add + float(DATA['gcp_price_list']['CP-COMPUTEENGINE-OS'][os]["high"]) * float(billing_cpu)
add = float(DATA['gcp_price_list']['CP-COMPUTEENGINE-OS']['win']["high"]) * float(billing_cpu) cost = float(cost)+add
add = add + float(DATA['gcp_price_list']['CP-COMPUTEENGINE-OS'][os]["high"]) * float(billing_cpu) print('google,%s,%s,%s,%s,%s,%s' % (name, cpu, memory, cost, region, os))
cost = float(cost)+add
print('google,%s,%s,%s,%s,%s,%s' % (name, cpu, memory, cost, region, os))
else: else:
print('google,%s,%s,%s,%s,%s,%s' % (name, cpu, memory, cost, region, os)) print('google,%s,%s,%s,%s,%s,%s' % (name, cpu, memory, cost, region, os))
\ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!