__author__ = "Alfonso Tierno, Gerardo Garcia, Pablo Montes"
__date__ = "$26-aug-2014 11:09:29$"
-__version__ = "0.5.62-r572"
+__version__ = "0.5.63-r573"
version_date = "May 2018"
database_version = 31 # expected database schema version
config=extra, persistent_info=persistent_info
)
except Exception as e:
- raise NfvoException("Error at VIM {}; {}: {}".format(vim["type"], type(e).__name__, str(e)), HTTP_Internal_Server_Error)
+ http_code = HTTP_Internal_Server_Error
+ if isinstance(e, vimconn.vimconnException):
+ http_code = e.http_code
+ raise NfvoException("Error at VIM {}; {}: {}".format(vim["type"], type(e).__name__, str(e)), http_code)
return vim_dict
except db_base_Exception as e:
raise NfvoException(str(e) + " at nfvo.get_vim", e.http_code)
logger.error("Cannot delete datacenter_tenants " + str(e))
pass # the error will be caused because dependencies, vim_tenant can not be deleted
thread_id = tenant_datacenter_item["datacenter_tenant_id"]
- thread = vim_threads["running"][thread_id]
- thread.insert_task("exit")
- vim_threads["deleting"][thread_id] = thread
+ thread = vim_threads["running"].get(thread_id)
+ if thread:
+ thread.insert_task("exit")
+ vim_threads["deleting"][thread_id] = thread
return "datacenter {} detached. {}".format(datacenter_id, warning)
if 'region_name' in config:
self.region = config.get('region_name')
else:
- raise vimconn.vimconnNotFoundException("AWS region_name is not specified at config")
+ raise vimconn.vimconnException("AWS region_name is not specified at config")
self.vpc_data = {}
self.subnet_data = {}
flavor_data = config.get('flavor_info')
if isinstance(flavor_data, str):
try:
- with open(flavor_data[1:], 'r') as stream:
- self.flavor_info = yaml.load(stream)
+ if flavor_data[0] == "@": # read from a file
+ with open(flavor_data[1:], 'r') as stream:
+ self.flavor_info = yaml.load(stream)
+ else:
+ self.flavor_info = yaml.load(flavor_data)
except yaml.YAMLError as e:
self.flavor_info = None
raise vimconn.vimconnException("Bad format at file '{}': {}".format(flavor_data[1:], e))