From db896fdf3ac9d8b2034b65c5b8a2dfb6c4f8d69f Mon Sep 17 00:00:00 2001 From: Clint Byrum Date: Tue, 17 Sep 2013 17:30:52 -0700 Subject: [PATCH] Make --version work properly We have pbr and we have oslo.config. Tell them about eachother. Change-Id: I65d449b0ed961c824a3e7c1307aab63f73bc03ad --- os_collect_config/collect.py | 4 +++- os_collect_config/version.py | 18 ++++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 os_collect_config/version.py diff --git a/os_collect_config/collect.py b/os_collect_config/collect.py index 2c9460d..77cbfdb 100644 --- a/os_collect_config/collect.py +++ b/os_collect_config/collect.py @@ -28,6 +28,7 @@ from os_collect_config import common from os_collect_config import ec2 from os_collect_config import exc from os_collect_config import heat_local +from os_collect_config import version from oslo.config import cfg DEFAULT_COLLECTORS = ['heat_local', 'ec2', 'cfn'] @@ -167,7 +168,8 @@ def getfilehash(files): def __main__(args=sys.argv, requests_impl_map=None): signal.signal(signal.SIGHUP, reexec_self) setup_conf() - CONF(args=args[1:], prog="os-collect-config") + CONF(args=args[1:], prog="os-collect-config", + version=version.version_info.version_string()) # This resets the logging infrastructure which prevents capturing log # output in tests cleanly, so should only be called if there isn't already diff --git a/os_collect_config/version.py b/os_collect_config/version.py new file mode 100644 index 0000000..d8aec69 --- /dev/null +++ b/os_collect_config/version.py @@ -0,0 +1,18 @@ +# Copyright (c) 2013 Hewlett-Packard Development Company, L.P. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + + +import pbr.version + +version_info = pbr.version.VersionInfo('os-collect-config')