Add --version option
Adds the option to query the (pbr generated) version string Change-Id: Ia8a19602802a1da1029f8e575dafcafcca87388a
This commit is contained in:
parent
0b71572687
commit
71ac3c6c5e
@ -0,0 +1,16 @@
|
||||
# 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__ = pbr.version.VersionInfo('python-tuskarclient').version_string()
|
@ -23,6 +23,7 @@ import sys
|
||||
|
||||
import six
|
||||
|
||||
import tuskarclient
|
||||
from tuskarclient import client
|
||||
import tuskarclient.common.utils as utils
|
||||
from tuskarclient.openstack.common.apiclient import exceptions as exc
|
||||
@ -68,8 +69,8 @@ class TuskarShell(object):
|
||||
|
||||
self._ensure_auth_info(args)
|
||||
|
||||
tuskar_client = client.get_client(self.partial_args.tuskar_api_version,
|
||||
**args.__dict__)
|
||||
tuskar_client = client.get_client(
|
||||
self.partial_args.tuskar_api_version, **args.__dict__)
|
||||
args.func(tuskar_client, args)
|
||||
|
||||
def _ensure_auth_info(self, args):
|
||||
@ -134,6 +135,11 @@ class TuskarShell(object):
|
||||
help="Print this help message and exit.",
|
||||
)
|
||||
|
||||
parser.add_argument('--version',
|
||||
action='version',
|
||||
version=tuskarclient.__version__,
|
||||
help="Shows the client version and exits.")
|
||||
|
||||
parser.add_argument('--os-username',
|
||||
default=utils.env('OS_USERNAME'),
|
||||
help='Defaults to env[OS_USERNAME]',
|
||||
|
Loading…
x
Reference in New Issue
Block a user