Add --version argument

Change-Id: I6d67e0b5b9d7dbae400ec94bdf41e2e1b47fa509
This commit is contained in:
Clint Byrum 2013-09-17 17:41:24 -07:00
parent 4fc170630c
commit a4f6404287
2 changed files with 21 additions and 0 deletions

View File

@ -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

View File

@ -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')