Add image attributes from v2.7
Add new image attributes added with APIv2.7: - os_hidden (hide from list) - os_hash_algo - os_hash_value Change-Id: I1ab56bff65b28ad0b441b598f2c15e97d87df6d7
This commit is contained in:
parent
dc092757d1
commit
11a5952933
@ -36,10 +36,11 @@ class Image(resource.Resource, resource.TagMixin):
|
|||||||
_query_mapping = resource.QueryParameters(
|
_query_mapping = resource.QueryParameters(
|
||||||
"name", "visibility",
|
"name", "visibility",
|
||||||
"member_status", "owner",
|
"member_status", "owner",
|
||||||
"status", "size_min",
|
"status", "size_min", "size_max",
|
||||||
"size_max", "sort_key",
|
"protected", "is_hidden",
|
||||||
"sort_dir", "sort", "tag",
|
"sort_key", "sort_dir", "sort", "tag",
|
||||||
"created_at", "updated_at")
|
"created_at", "updated_at",
|
||||||
|
is_hidden="os_hidden")
|
||||||
|
|
||||||
# NOTE: Do not add "self" support here. If you've used Python before,
|
# NOTE: Do not add "self" support here. If you've used Python before,
|
||||||
# you know that self, while not being a reserved word, has special
|
# you know that self, while not being a reserved word, has special
|
||||||
@ -69,9 +70,18 @@ class Image(resource.Resource, resource.TagMixin):
|
|||||||
#: disk image. Virtual appliance vendors have different formats
|
#: disk image. Virtual appliance vendors have different formats
|
||||||
#: for laying out the information contained in a VM disk image.
|
#: for laying out the information contained in a VM disk image.
|
||||||
disk_format = resource.Body('disk_format')
|
disk_format = resource.Body('disk_format')
|
||||||
|
#: This field controls whether an image is displayed in the default
|
||||||
|
#: image-list response
|
||||||
|
is_hidden = resource.Body('os_hidden', type=bool)
|
||||||
#: Defines whether the image can be deleted.
|
#: Defines whether the image can be deleted.
|
||||||
#: *Type: bool*
|
#: *Type: bool*
|
||||||
is_protected = resource.Body('protected', type=bool)
|
is_protected = resource.Body('protected', type=bool)
|
||||||
|
#: The algorithm used to compute a secure hash of the image data
|
||||||
|
#: for this image
|
||||||
|
hash_algo = resource.Body('os_hash_algo')
|
||||||
|
#: The hexdigest of the secure hash of the image data computed using
|
||||||
|
#: the algorithm whose name is the value of the os_hash_algo property.
|
||||||
|
hash_value = resource.Body('os_hash_value')
|
||||||
#: The minimum disk size in GB that is required to boot the image.
|
#: The minimum disk size in GB that is required to boot the image.
|
||||||
min_disk = resource.Body('min_disk')
|
min_disk = resource.Body('min_disk')
|
||||||
#: The minimum amount of RAM in MB that is required to boot the image.
|
#: The minimum amount of RAM in MB that is required to boot the image.
|
||||||
|
@ -36,6 +36,9 @@ EXAMPLE = {
|
|||||||
'status': '8',
|
'status': '8',
|
||||||
'tags': ['g', 'h', 'i'],
|
'tags': ['g', 'h', 'i'],
|
||||||
'updated_at': '2015-03-09T12:15:57.233772',
|
'updated_at': '2015-03-09T12:15:57.233772',
|
||||||
|
'os_hash_algo': 'sha512',
|
||||||
|
'os_hash_value': '073b4523583784fbe01daff81eba092a262ec3',
|
||||||
|
'os_hidden': False,
|
||||||
'virtual_size': '10',
|
'virtual_size': '10',
|
||||||
'visibility': '11',
|
'visibility': '11',
|
||||||
'location': '12',
|
'location': '12',
|
||||||
@ -119,6 +122,26 @@ class TestImage(base.TestCase):
|
|||||||
self.assertTrue(sot.allow_delete)
|
self.assertTrue(sot.allow_delete)
|
||||||
self.assertTrue(sot.allow_list)
|
self.assertTrue(sot.allow_list)
|
||||||
|
|
||||||
|
self.assertDictEqual({'created_at': 'created_at',
|
||||||
|
'is_hidden': 'os_hidden',
|
||||||
|
'limit': 'limit',
|
||||||
|
'marker': 'marker',
|
||||||
|
'member_status': 'member_status',
|
||||||
|
'name': 'name',
|
||||||
|
'owner': 'owner',
|
||||||
|
'protected': 'protected',
|
||||||
|
'size_max': 'size_max',
|
||||||
|
'size_min': 'size_min',
|
||||||
|
'sort': 'sort',
|
||||||
|
'sort_dir': 'sort_dir',
|
||||||
|
'sort_key': 'sort_key',
|
||||||
|
'status': 'status',
|
||||||
|
'tag': 'tag',
|
||||||
|
'updated_at': 'updated_at',
|
||||||
|
'visibility': 'visibility'
|
||||||
|
},
|
||||||
|
sot._query_mapping._mapping)
|
||||||
|
|
||||||
def test_make_it(self):
|
def test_make_it(self):
|
||||||
sot = image.Image(**EXAMPLE)
|
sot = image.Image(**EXAMPLE)
|
||||||
self.assertEqual(IDENTIFIER, sot.id)
|
self.assertEqual(IDENTIFIER, sot.id)
|
||||||
@ -134,6 +157,9 @@ class TestImage(base.TestCase):
|
|||||||
self.assertEqual(EXAMPLE['status'], sot.status)
|
self.assertEqual(EXAMPLE['status'], sot.status)
|
||||||
self.assertEqual(EXAMPLE['tags'], sot.tags)
|
self.assertEqual(EXAMPLE['tags'], sot.tags)
|
||||||
self.assertEqual(EXAMPLE['updated_at'], sot.updated_at)
|
self.assertEqual(EXAMPLE['updated_at'], sot.updated_at)
|
||||||
|
self.assertEqual(EXAMPLE['os_hash_algo'], sot.hash_algo)
|
||||||
|
self.assertEqual(EXAMPLE['os_hash_value'], sot.hash_value)
|
||||||
|
self.assertEqual(EXAMPLE['os_hidden'], sot.is_hidden)
|
||||||
self.assertEqual(EXAMPLE['virtual_size'], sot.virtual_size)
|
self.assertEqual(EXAMPLE['virtual_size'], sot.virtual_size)
|
||||||
self.assertEqual(EXAMPLE['visibility'], sot.visibility)
|
self.assertEqual(EXAMPLE['visibility'], sot.visibility)
|
||||||
self.assertEqual(EXAMPLE['size'], sot.size)
|
self.assertEqual(EXAMPLE['size'], sot.size)
|
||||||
|
@ -0,0 +1,3 @@
|
|||||||
|
---
|
||||||
|
features:
|
||||||
|
- Add image attributes is_hidden, hash_algo, hash_value
|
Loading…
Reference in New Issue
Block a user