diff --git a/openstack/image/v1/image.py b/openstack/image/v1/image.py index 9fc7e7c08..c4905abfd 100644 --- a/openstack/image/v1/image.py +++ b/openstack/image/v1/image.py @@ -70,7 +70,9 @@ class Image(resource.Resource, _download.DownloadMixin): #: of images owned by others. name = resource.Body('name') #: The ID of the owner, or project, of the image. - owner_id = resource.Body('owner') + owner = resource.Body('owner', alias='owner_id') + #: The ID of the owner, or project, of the image. (backwards compat) + owner_id = resource.Body('owner', alias='owner') #: Properties, if any, that are associated with the image. properties = resource.Body('properties') #: The size of the image data, in bytes. diff --git a/openstack/image/v2/image.py b/openstack/image/v2/image.py index 3e0f223d2..a502e811f 100644 --- a/openstack/image/v2/image.py +++ b/openstack/image/v2/image.py @@ -88,7 +88,9 @@ class Image(resource.Resource, resource.TagMixin, _download.DownloadMixin): #: The name of the image. name = resource.Body('name') #: The ID of the owner, or project, of the image. - owner_id = resource.Body('owner') + owner = resource.Body('owner', alias='owner_id') + #: The ID of the owner, or project, of the image. (backwards compat) + owner_id = resource.Body('owner', alias='owner') # TODO(mordred) This is not how this works in v2. I mean, it's how it # should work, but it's not. We need to fix properties. They work right # in shade, so we can draw some logic from there. diff --git a/openstack/tests/unit/image/v1/test_image.py b/openstack/tests/unit/image/v1/test_image.py index 133c4232e..d593e727d 100644 --- a/openstack/tests/unit/image/v1/test_image.py +++ b/openstack/tests/unit/image/v1/test_image.py @@ -61,6 +61,7 @@ class TestImage(base.TestCase): self.assertEqual(EXAMPLE['min_disk'], sot.min_disk) self.assertEqual(EXAMPLE['min_ram'], sot.min_ram) self.assertEqual(EXAMPLE['name'], sot.name) + self.assertEqual(EXAMPLE['owner'], sot.owner) self.assertEqual(EXAMPLE['owner'], sot.owner_id) self.assertEqual(EXAMPLE['properties'], sot.properties) self.assertTrue(sot.is_protected) diff --git a/openstack/tests/unit/image/v2/test_image.py b/openstack/tests/unit/image/v2/test_image.py index 4bc95baf6..f3752d8f1 100644 --- a/openstack/tests/unit/image/v2/test_image.py +++ b/openstack/tests/unit/image/v2/test_image.py @@ -168,6 +168,7 @@ class TestImage(base.TestCase): self.assertEqual(EXAMPLE['disk_format'], sot.disk_format) self.assertEqual(EXAMPLE['min_disk'], sot.min_disk) self.assertEqual(EXAMPLE['name'], sot.name) + self.assertEqual(EXAMPLE['owner'], sot.owner) self.assertEqual(EXAMPLE['owner'], sot.owner_id) self.assertEqual(EXAMPLE['properties'], sot.properties) self.assertFalse(sot.is_protected)