From a4f6404287dcd9609ea46b649e303f4a7063c166 Mon Sep 17 00:00:00 2001 From: Clint Byrum Date: Tue, 17 Sep 2013 17:41:24 -0700 Subject: [PATCH] Add --version argument Change-Id: I6d67e0b5b9d7dbae400ec94bdf41e2e1b47fa509 --- os_apply_config/apply_config.py | 3 +++ os_apply_config/version.py | 18 ++++++++++++++++++ 2 files changed, 21 insertions(+) create mode 100644 os_apply_config/version.py diff --git a/os_apply_config/apply_config.py b/os_apply_config/apply_config.py index d0dbff5..27ebc81 100755 --- a/os_apply_config/apply_config.py +++ b/os_apply_config/apply_config.py @@ -27,6 +27,7 @@ from os_apply_config import collect_config from os_apply_config import config_exception as exc from os_apply_config import renderers from os_apply_config import value_types +from os_apply_config import version TEMPLATES_DIR = os.environ.get('OS_CONFIG_APPLIER_TEMPLATES', None) if TEMPLATES_DIR is None: @@ -197,6 +198,8 @@ def parse_opts(argv): ' not subject to type restrictions. If --key is' ' specified and no default is specified, program' ' exits with an error on missing key.') + parser.add_argument('--version', action='version', + version=version.version_info.version_string()) opts = parser.parse_args(argv[1:]) return opts diff --git a/os_apply_config/version.py b/os_apply_config/version.py new file mode 100644 index 0000000..d4af00b --- /dev/null +++ b/os_apply_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-apply-config')