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:
cost = DATA['gcp_price_list'][product][region]
if PRODUCT_FAMILY == COMPUTE_PRODUCT_FAMILY:
cost = DATA['gcp_price_list'][product][region]
for os in GCE_OS:
if os == 'linux':
add = 0
else:
billing_cores = DATA['gcp_price_list']['CP-COMPUTEENGINE-OS'][os]["cores"]
billing_cpu = cpu
if billing_cores == 'shared':
billing_cores = 1
if billing_cpu == 'shared':
billing_cpu = 1
#TODO: Make this logic elegant (use cores/shared logic)
if 'win' in os:
if 'f1-micro' in name or 'g1-small' in name:
add = float(DATA['gcp_price_list']['CP-COMPUTEENGINE-OS'][os]["low"])
else:
add = float(DATA['gcp_price_list']['CP-COMPUTEENGINE-OS'][os]["high"]) * float(billing_cpu)
elif 'rhel' in os:
if float(billing_cpu) <= 4:
add = float(DATA['gcp_price_list']['CP-COMPUTEENGINE-OS'][os]["low"])
else:
if float(cost) != 0 :
for os in GCE_OS:
if os == 'linux':
add = 0
else:
billing_cores = DATA['gcp_price_list']['CP-COMPUTEENGINE-OS'][os]["cores"]
billing_cpu = cpu
if billing_cores == 'shared':
billing_cores = 1
if billing_cpu == 'shared':
billing_cpu = 1
#TODO: Make this logic elegant (use cores/shared logic)
if 'win' in os:
if 'f1-micro' in name or 'g1-small' in name:
add = float(DATA['gcp_price_list']['CP-COMPUTEENGINE-OS'][os]["low"])
else:
add = float(DATA['gcp_price_list']['CP-COMPUTEENGINE-OS'][os]["high"]) * float(billing_cpu)
elif 'rhel' in os:
if float(billing_cpu) <= 4:
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"])
elif 'suse-sap' in os:
add = float(DATA['gcp_price_list']['CP-COMPUTEENGINE-OS'][os]["high"])
elif 'suse' in os:
if 'f1-micro' in name or 'g1-small' in name:
add = float(DATA['gcp_price_list']['CP-COMPUTEENGINE-OS'][os]["low"])
else:
add = float(DATA['gcp_price_list']['CP-COMPUTEENGINE-OS'][os]["high"]) * float(billing_cpu)
elif 'sql' in os:
if 'f1-micro' in name or 'g1-small' in name:
add = float(DATA['gcp_price_list']['CP-COMPUTEENGINE-OS']['win']["low"])
else:
add = float(DATA['gcp_price_list']['CP-COMPUTEENGINE-OS']['win']["high"]) * float(billing_cpu)
add = add + float(DATA['gcp_price_list']['CP-COMPUTEENGINE-OS'][os]["high"]) * float(billing_cpu)
cost = float(cost)+add
print('google,%s,%s,%s,%s,%s,%s' % (name, cpu, memory, cost, region, os))
elif 'suse' in os:
if 'f1-micro' in name or 'g1-small' in name:
add = float(DATA['gcp_price_list']['CP-COMPUTEENGINE-OS'][os]["low"])
else:
add = float(DATA['gcp_price_list']['CP-COMPUTEENGINE-OS'][os]["high"]) * float(billing_cpu)
elif 'sql' in os:
if 'f1-micro' in name or 'g1-small' in name:
add = float(DATA['gcp_price_list']['CP-COMPUTEENGINE-OS']['win']["low"])
else:
add = float(DATA['gcp_price_list']['CP-COMPUTEENGINE-OS']['win']["high"]) * float(billing_cpu)
add = add + float(DATA['gcp_price_list']['CP-COMPUTEENGINE-OS'][os]["high"]) * float(billing_cpu)
cost = float(cost)+add
print('google,%s,%s,%s,%s,%s,%s' % (name, cpu, memory, cost, region, os))
else:
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!