Merge "Show openstacksdk version info in "module list""

This commit is contained in:
Jenkins 2017-02-22 22:51:28 +00:00 committed by Gerrit Code Review
commit c8435f2d5a
3 changed files with 14 additions and 2 deletions

View File

@ -86,7 +86,15 @@ class ListModule(command.ShowOne):
# Handle xxxclient and openstacksdk
(k.endswith('client') or k == 'openstack')):
try:
data[k] = mods[k].__version__
# NOTE(RuiChen): openstacksdk bug/1588823 exist,
# no good way to add __version__ for
# openstack module properly, hard code
# looks bad, but openstacksdk module
# information is important.
if k == 'openstack':
data[k] = mods[k].version.__version__
else:
data[k] = mods[k].__version__
except Exception:
# Catch all exceptions, just skip it
pass

View File

@ -23,7 +23,8 @@ class ModuleTest(base.TestCase):
CLIENTS = ['openstackclient',
'keystoneclient',
'novaclient']
'novaclient',
'openstack']
LIBS = ['osc_lib',
'os_client_config',

View File

@ -161,6 +161,9 @@ class FakeModule(object):
def __init__(self, name, version):
self.name = name
self.__version__ = version
# Workaround for openstacksdk case
self.version = mock.Mock()
self.version.__version__ = version
class FakeResource(object):