Resource properties are now dict

Change-Id: I73ebb7603ed5ed4028427314a8bbc4b5e1eee123
This commit is contained in:
Travis Tripp 2014-05-07 17:08:12 -06:00
parent e6ab5303b2
commit c6649272ef
1 changed files with 7 additions and 7 deletions

View File

@ -81,8 +81,8 @@ class GlanceResourceDriver(base.ResourceInterface):
and capability.capability_type \ and capability.capability_type \
== self.unknown_properties_type: == self.unknown_properties_type:
# For unknown properties, just directly set property name. # For unknown properties, just directly set property name.
for property in capability.properties: for property_name, property_value in capability.properties.iteritems():
image_properties[property.name] = property.value image_properties[property_name] = property_value
else: else:
properties = capability.properties properties = capability.properties
capability_type = self.replace_colon_from_name( capability_type = self.replace_colon_from_name(
@ -92,13 +92,13 @@ class GlanceResourceDriver(base.ResourceInterface):
capability.capability_type_namespace capability.capability_type_namespace
) )
for property in properties: for property_name, property_value in properties.iteritems():
prop_name = capability_type_namespace + \ prop_name = capability_type_namespace + \
self.separator + \ self.separator + \
capability_type + \ capability_type + \
self.separator + \ self.separator + \
self.replace_colon_from_name(property.name) self.replace_colon_from_name(property_name)
image_properties[prop_name] = property.value image_properties[prop_name] = property_value
image = glance_client.images.get(resource.id) image = glance_client.images.get(resource.id)
image.update(properties=image_properties, purge_props=False) image.update(properties=image_properties, purge_props=False)
@ -210,12 +210,12 @@ class GlanceResourceDriver(base.ResourceInterface):
if not image_capability: if not image_capability:
image_capability = Capability() image_capability = Capability()
image_capability.properties = [] image_capability.properties = {}
image_resource.capabilities.append(image_capability) image_resource.capabilities.append(image_capability)
image_capability.capability_type_namespace = namespace image_capability.capability_type_namespace = namespace
image_capability.capability_type = capability_type image_capability.capability_type = capability_type
image_capability.properties.append(image_property) image_capability.properties[image_property.name] = image_property.value
return image_resource return image_resource