projects
/
osm
/
RO.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fix 1168 ensure VIM plugin is loaded at vim_account_create
[osm/RO.git]
/
RO
/
osm_ro
/
openmanod.py
diff --git
a/RO/osm_ro/openmanod.py
b/RO/osm_ro/openmanod.py
index
637b1da
..
19f7788
100755
(executable)
--- a/
RO/osm_ro/openmanod.py
+++ b/
RO/osm_ro/openmanod.py
@@
-53,9
+53,9
@@
import osm_ro
__author__ = "Alfonso Tierno, Gerardo Garcia, Pablo Montes"
__date__ = "$26-aug-2014 11:09:29$"
__author__ = "Alfonso Tierno, Gerardo Garcia, Pablo Montes"
__date__ = "$26-aug-2014 11:09:29$"
-__version__ = "
6.0.4.post6
"
-version_date = "
Oct 2019
"
-database_version = 4
0
# expected database schema version
+__version__ = "
8.0.0.post1
"
+version_date = "
Jul 2020
"
+database_version = 4
1
# expected database schema version
global global_config
global logger
global global_config
global logger
@@
-157,6
+157,20
@@
def set_logging_file(log_file):
"Cannot open logging file '{}': {}. Check folder exist and permissions".format(log_file, e))
"Cannot open logging file '{}': {}. Check folder exist and permissions".format(log_file, e))
+def _get_version():
+ """
+ Try to get version from package using pkg_resources (available with setuptools)
+ """
+ global __version__
+ ro_version = __version__
+ try:
+ from pkg_resources import get_distribution
+ ro_version = get_distribution("osm_ro").version
+ except Exception:
+ pass
+ return ro_version
+
+
if __name__ == "__main__":
# env2config contains environ variable names and the correspondence with configuration file openmanod.cfg keys.
# If this environ is defined, this value is taken instead of the one at at configuration file
if __name__ == "__main__":
# env2config contains environ variable names and the correspondence with configuration file openmanod.cfg keys.
# If this environ is defined, this value is taken instead of the one at at configuration file
@@
-172,6
+186,7
@@
if __name__ == "__main__":
'RO_LOG_LEVEL': 'log_level',
'RO_LOG_FILE': 'log_file',
}
'RO_LOG_LEVEL': 'log_level',
'RO_LOG_FILE': 'log_file',
}
+ ro_version = _get_version()
# Configure logging step 1
hostname = socket.gethostname()
log_formatter_str = '%(asctime)s.%(msecs)03d00Z[{host}@openmanod] %(filename)s:%(lineno)s severity:%(levelname)s logger:%(name)s log:%(message)s'
# Configure logging step 1
hostname = socket.gethostname()
log_formatter_str = '%(asctime)s.%(msecs)03d00Z[{host}@openmanod] %(filename)s:%(lineno)s severity:%(levelname)s logger:%(name)s log:%(message)s'
@@
-200,7
+215,7
@@
if __name__ == "__main__":
for o, a in opts:
if o in ("-v", "--version"):
for o, a in opts:
if o in ("-v", "--version"):
- print ("openmanod version
" + __version__ + ' ' + version_date
)
+ print ("openmanod version
{} {}".format(ro_version, version_date)
)
print ("(c) Copyright Telefonica")
sys.exit()
elif o in ("-h", "--help"):
print ("(c) Copyright Telefonica")
sys.exit()
elif o in ("-h", "--help"):
@@
-227,7
+242,7
@@
if __name__ == "__main__":
if log_file:
set_logging_file(log_file)
global_config = load_configuration(config_file)
if log_file:
set_logging_file(log_file)
global_config = load_configuration(config_file)
- global_config["version"] =
__version__
+ global_config["version"] =
ro_version
global_config["version_date"] = version_date
# Override parameters obtained by command line on ENV
if port:
global_config["version_date"] = version_date
# Override parameters obtained by command line on ENV
if port:
@@
-275,9
+290,9
@@
if __name__ == "__main__":
logger.setLevel(getattr(logging, global_config['log_level']))
logger.critical("Starting openmano server version: '%s %s' command: '%s'",
logger.setLevel(getattr(logging, global_config['log_level']))
logger.critical("Starting openmano server version: '%s %s' command: '%s'",
-
__version__
, version_date, " ".join(sys.argv))
+
ro_version
, version_date, " ".join(sys.argv))
- for log_module in ("nfvo", "http", "vim", "wim", "db", "console", "ovim"):
+ for log_module in ("nfvo", "http", "vim", "wim", "db", "console", "ovim"
, "sdn", "sdnconn"
):
log_level_module = "log_level_" + log_module
log_file_module = "log_file_" + log_module
logger_module = logging.getLogger('openmano.' + log_module)
log_level_module = "log_level_" + log_module
log_file_module = "log_file_" + log_module
logger_module = logging.getLogger('openmano.' + log_module)