From bee508e36ae6ada29e1127719e42a4f877ef700c Mon Sep 17 00:00:00 2001 From: tierno Date: Mon, 21 Jan 2019 11:21:49 +0000 Subject: [PATCH] Log NBI version Change-Id: I4aa09a66d26d4117e84789cddcb99106a680e232 Signed-off-by: tierno --- osm_nbi/html_public/version | 5 ++--- osm_nbi/nbi.py | 19 +++++++++---------- 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/osm_nbi/html_public/version b/osm_nbi/html_public/version index 4e88043..1c596ef 100644 --- a/osm_nbi/html_public/version +++ b/osm_nbi/html_public/version @@ -1,3 +1,2 @@ -0.1.33 -2018-12-21 - +0.1.34 +2018-01-21 diff --git a/osm_nbi/nbi.py b/osm_nbi/nbi.py index 46c7c9b..a1e8b50 100644 --- a/osm_nbi/nbi.py +++ b/osm_nbi/nbi.py @@ -37,9 +37,8 @@ from os import environ, path __author__ = "Alfonso Tierno " -# TODO consider to remove and provide version using the static version file __version__ = "0.1.3" -version_date = "Apr 2018" +version_date = "Jan 2019" database_version = '1.0' auth_database_version = '1.0' @@ -898,13 +897,6 @@ class Server(object): # raise cherrypy.HTTPError(e.http_code.value, str(e)) -# def validate_password(realm, username, password): -# cherrypy.log("realm "+ str(realm)) -# if username == "admin" and password == "admin": -# return True -# return False - - def _start_service(): """ Callback function called when cherrypy.engine starts @@ -995,7 +987,14 @@ def _start_service(): cherrypy.tree.apps['/osm'].root.authenticator.start(engine_config) cherrypy.tree.apps['/osm'].root.engine.init_db(target_version=database_version) cherrypy.tree.apps['/osm'].root.authenticator.init_db(target_version=auth_database_version) - # getenv('OSMOPENMANO_TENANT', None) + + # load and print version. Ignore possible errors, e.g. file not found + try: + with open("{}/version".format(engine_config["/static"]['tools.staticdir.dir'])) as version_file: + version_data = version_file.read() + cherrypy.log.error("Starting OSM NBI Version: {}".format(version_data.replace("\n", " "))) + except Exception: + pass def _stop_service(): -- 2.25.1