Expose visibility on images
Visibility can be public, private and shared - and community is coming in O1. Make sure that we don't lose that information in our normalization. Change-Id: I148547e3026fe155c911d9a51cb51d8901c83650
This commit is contained in:
@@ -110,6 +110,7 @@ A Glance Image.
|
||||
owner=str(),
|
||||
is_public=bool(),
|
||||
is_protected=bool(),
|
||||
visibility=str(),
|
||||
status=str(),
|
||||
locations=list(),
|
||||
direct_url=str() or None,
|
||||
|
||||
@@ -220,6 +220,7 @@ class Normalizer(object):
|
||||
properties.setdefault(key, val)
|
||||
new_image['properties'] = properties
|
||||
new_image['is_public'] = is_public
|
||||
new_image['visibility'] = visibility
|
||||
|
||||
# Backwards compat with glance
|
||||
if not self.strict_mode:
|
||||
@@ -230,7 +231,6 @@ class Normalizer(object):
|
||||
new_image['updated'] = new_image['updated_at']
|
||||
new_image['minDisk'] = new_image['min_disk']
|
||||
new_image['minRam'] = new_image['min_ram']
|
||||
new_image['visibility'] = visibility
|
||||
return new_image
|
||||
|
||||
def _normalize_secgroups(self, groups):
|
||||
|
||||
@@ -390,7 +390,8 @@ class TestUtils(base.TestCase):
|
||||
'status': u'active',
|
||||
'tags': [],
|
||||
'updated_at': u'2015-02-15T23:04:34Z',
|
||||
'virtual_size': 0}
|
||||
'virtual_size': 0,
|
||||
'visibility': 'private'}
|
||||
retval = self.strict_cloud._normalize_image(raw_image).toDict()
|
||||
self.assertEqual(sorted(expected.keys()), sorted(retval.keys()))
|
||||
self.assertEqual(expected, retval)
|
||||
@@ -515,7 +516,8 @@ class TestUtils(base.TestCase):
|
||||
'status': u'active',
|
||||
'tags': [],
|
||||
'updated_at': u'2015-02-15T23:04:34Z',
|
||||
'virtual_size': 0}
|
||||
'virtual_size': 0,
|
||||
'visibility': 'private'}
|
||||
retval = self.strict_cloud._normalize_image(raw_image).toDict()
|
||||
self.assertEqual(sorted(expected.keys()), sorted(retval.keys()))
|
||||
self.assertEqual(expected, retval)
|
||||
|
||||
Reference in New Issue
Block a user