Commit f30e1156 by diegolima

melhorar tratamento de tipo de produto

1 parent 2b69923b
Showing with 5 additions and 11 deletions
......@@ -3,17 +3,9 @@ import json
import sys
import urllib.request
if len(sys.argv) == 1:
print('You need to specify a product type')
print('Supported product types are:')
print('- compute')
print('- database')
exit(1)
PRODUCT_TYPE = sys.argv[1]
if (PRODUCT_TYPE != 'compute') and (PRODUCT_TYPE != 'database'):
print('Product type needs to be either computer or database!')
exit(1)
PRODUCT_TYPE = sys.argv[1] if len(sys.argv) == 2 else 'none'
COMPUTE_PRODUCT_FAMILY = 'CP-COMPUTEENGINE-VMIMAGE-'
DB_PRODUCT_FAMILY = 'CP-DB-'
if PRODUCT_TYPE == 'compute':
......@@ -24,6 +16,9 @@ elif PRODUCT_TYPE == 'database':
FCATALOG = 'examples/gce_pricelist.json'
CATALOG = 'https://cloudpricingcalculator.appspot.com/static/data/pricelist.json'
PRODUCT_FAMILY = DB_PRODUCT_FAMILY
else:
print("Product type not supported")
sys.exit(1)
GCE_REGIONS = [
'us-central1', 'us-east1', 'us-east4', 'us-west1',
......@@ -34,7 +29,6 @@ GCE_REGIONS = [
]
GCE_OS = ['linux', 'win', 'rhel', 'suse', 'suse-sap', 'sql-standard', 'sql-web', 'sql-enterprise']
#TODO: Download & decompress the gzipped current catalog
with urllib.request.urlopen(CATALOG) as url:
DATA = json.loads(url.read().decode())
#with open(FCATALOG) as url:
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!