From 69e04b1c3aaa851d8572ca8f6a4aafbb8bb51fc9 Mon Sep 17 00:00:00 2001 From: Monsyne Dragon Date: Tue, 5 Sep 2017 20:13:04 +0000 Subject: [PATCH] Add Version number in logs at start. Report the version number on startup of verifier and worker daemons to make debugging of deployments easier. Change-Id: Ib6f9008ab103a67d958004e7151f30065daa5a3d --- etc/pip-requires.txt | 1 - etc/test-requires.txt | 1 + setup.cfg | 3 ++- stacktach/version.py | 8 ++++++++ verifier/start_verifier.py | 4 +++- worker/start_workers.py | 4 +++- 6 files changed, 17 insertions(+), 4 deletions(-) create mode 100644 stacktach/version.py diff --git a/etc/pip-requires.txt b/etc/pip-requires.txt index f16ae77..2e40f82 100644 --- a/etc/pip-requires.txt +++ b/etc/pip-requires.txt @@ -10,4 +10,3 @@ requests south sphinxcontrib-httpdomain pbr -mock==2.0.0 diff --git a/etc/test-requires.txt b/etc/test-requires.txt index fe4f79f..1ab7883 100644 --- a/etc/test-requires.txt +++ b/etc/test-requires.txt @@ -1,5 +1,6 @@ coverage hacking +mock==2.0.0 mox nose nose-exclude diff --git a/setup.cfg b/setup.cfg index 01a1ff0..4a9339d 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,5 +1,6 @@ [metadata] name = stacktach +version = 2.2 author = Dark Secret Software Inc., Rackspace Hosting author-email = admin@darksecretsoftware.com summary = OpenStack Monitoring and Billing @@ -19,4 +20,4 @@ keywords = distutils [files] packages = - stacktach \ No newline at end of file + stacktach diff --git a/stacktach/version.py b/stacktach/version.py new file mode 100644 index 0000000..ff5a988 --- /dev/null +++ b/stacktach/version.py @@ -0,0 +1,8 @@ +import pbr.version + + +version_info = pbr.version.VersionInfo('stacktach') + + +def get_version(): + return version_info.version_string() diff --git a/verifier/start_verifier.py b/verifier/start_verifier.py index b4f9564..175b138 100644 --- a/verifier/start_verifier.py +++ b/verifier/start_verifier.py @@ -30,6 +30,7 @@ if os.path.exists(os.path.join(POSSIBLE_TOPDIR, 'stacktach')): sys.path.insert(0, POSSIBLE_TOPDIR) from stacktach import stacklog from stacktach import reconciler +from stacktach import version from verifier import nova_verifier from verifier import glance_verifier import verifier.config as verifier_config @@ -186,7 +187,8 @@ if __name__ == '__main__': signal.signal(signal.SIGTERM, kill_time) signal.signal(signal.SIGUSR1, kill_time) - logger.info("Starting Verifiers...") + ver = "(Version: %s )" % version.get_version() + logger.info("Starting Verifiers %s..." % ver) while RUNNING: check_or_start_all() time.sleep(30) diff --git a/worker/start_workers.py b/worker/start_workers.py index e4e1f57..18b9084 100644 --- a/worker/start_workers.py +++ b/worker/start_workers.py @@ -12,6 +12,7 @@ if os.path.exists(os.path.join(POSSIBLE_TOPDIR, 'stacktach')): sys.path.insert(0, POSSIBLE_TOPDIR) from stacktach import db, stacklog +from stacktach import version from django.db import close_connection import worker.worker as worker @@ -130,7 +131,8 @@ if __name__ == '__main__': signal.signal(signal.SIGINT, kill_time) signal.signal(signal.SIGTERM, kill_time) - logger.info("Starting Workers...") + ver = "(Version: %s )" % version.get_version() + logger.info("Starting Workers %s..." % ver) while RUNNING: check_or_start_all() time.sleep(30)