Ship the default metadata schema in the client

Now the help message of namespace and resource_type are wrong,
we could see a <unavailable> error when try to get the help
information, such as "glance help md-namespace-create".

See the patch[1] to get more information. the patch[1] added
image schema, but the metadata schema are needed as well.

This patch adds the current metadata schema into client, so that
help text can't be rendered when there schema is not available in
the system.

[1]: https://review.openstack.org/#/c/209536/3

Change-Id: I2ab94d8768114a7e5c475310ba094af653627658
Closes-Bug: #1536430
This commit is contained in:
wangxiyuan
2016-01-19 16:31:36 +08:00
parent 14b9ba2981
commit d3de9ed16a
4 changed files with 330 additions and 0 deletions
+14
View File
@@ -178,6 +178,20 @@ class ShellTest(testutils.TestCase):
self.assertNotIn('<unavailable>', actual)
self.assertFalse(et_mock.called)
argstr = '--os-image-api-version 2 help md-namespace-create'
with mock.patch.object(shell, '_get_keystone_session') as et_mock:
actual = shell.main(argstr.split())
self.assertEqual(0, actual)
self.assertNotIn('<unavailable>', actual)
self.assertFalse(et_mock.called)
argstr = '--os-image-api-version 2 help md-resource-type-associate'
with mock.patch.object(shell, '_get_keystone_session') as et_mock:
actual = shell.main(argstr.split())
self.assertEqual(0, actual)
self.assertNotIn('<unavailable>', actual)
self.assertFalse(et_mock.called)
def test_get_base_parser(self):
test_shell = openstack_shell.OpenStackImagesShell()
actual_parser = test_shell.get_base_parser()