fix moving openvim version/date/db_version to ovim 88/1388/1
authortierno <alfonso.tiernosepulveda@telefonica.com>
Tue, 28 Mar 2017 15:23:15 +0000 (17:23 +0200)
committertierno <alfonso.tiernosepulveda@telefonica.com>
Tue, 28 Mar 2017 15:23:15 +0000 (17:23 +0200)
Change-Id: If59a7d7d238268c3601e68a5d6feabbf11deed5b
Signed-off-by: tierno <alfonso.tiernosepulveda@telefonica.com>
openvimd.py
ovim.py

index 3acbedf..b9d9d82 100755 (executable)
@@ -217,9 +217,7 @@ if __name__=="__main__":
             print '!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!'
             print "!! Warning, openvimd in TEST mode '%s'" % config_dic['mode']
             print '!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!'
-        config_dic['version'] = ovim.get_version()
-
-        config_dic["database_version"] = ovim.ovim.get_database_version()
+        config_dic['version'] = ovim.ovim.get_version()
         config_dic["logger_name"] = "openvim"
 
         engine = ovim.ovim(config_dic)
diff --git a/ovim.py b/ovim.py
index edd0b4c..f896adc 100644 (file)
--- a/ovim.py
+++ b/ovim.py
@@ -164,15 +164,16 @@ class ovim():
         Start ovim services
         :return:
         """
+        global database_version
         # if self.running_info:
         #    return  #TODO service can be checked and rebuild broken threads
         r = self.db.get_db_version()
         if r[0] < 0:
             raise ovimException("DATABASE is not a VIM one or it is a '0.0' version. Try to upgrade to version '{}' with "\
-                                "'./database_utils/migrate_vim_db.sh'".format(self.config["database_version"]) )
-        elif r[1] != self.config["database_version"]:
+                                "'./database_utils/migrate_vim_db.sh'".format(database_version) )
+        elif r[1] != database_version:
             raise ovimException("DATABASE wrong version '{}'. Try to upgrade/downgrade to version '{}' with "\
-                                "'./database_utils/migrate_vim_db.sh'".format(r[1], self.config["database_version"]) )
+                                "'./database_utils/migrate_vim_db.sh'".format(r[1], database_version) )
 
         # create database connection for openflow threads
         self.db_of = self._create_database_connection()