- mydb = nfvo_db.nfvo_db(log_level=global_config["log_level_db"]);
- if mydb.connect(global_config['db_host'], global_config['db_user'], global_config['db_passwd'], global_config['db_name']) == -1:
- logger.critical("Cannot connect to database %s at %s@%s", global_config['db_name'], global_config['db_user'], global_config['db_host'])
- exit(-1)
- r = mydb.get_db_version()
- if r[0]<0:
- logger.critical("DATABASE is not a MANO one or it is a '0.0' version. Try to upgrade to version '%s' with './database_utils/migrate_mano_db.sh'", database_version)
+ mydb = nfvo_db.nfvo_db();
+ mydb.connect(global_config['db_host'], global_config['db_user'], global_config['db_passwd'], global_config['db_name'])
+ try:
+ r = mydb.get_db_version()
+ if r[1] != database_version:
+ logger.critical("DATABASE wrong version '%s'. \
+ Try to upgrade/downgrade to version '%s' with './database_utils/migrate_mano_db.sh'",
+ r[1], database_version)
+ exit(-1)
+ except db_base_Exception as e:
+ logger.critical("DATABASE is not a MANO one or it is a '0.0' version. Try to upgrade to version '%s' with \
+ './database_utils/migrate_mano_db.sh'", database_version)