Resolve discrepancy between ids Fixes #68 and #69.
Note: This change must be deployed with change 796ac395af6a58409190c6c2d841a8cd6437f77e in ansible-modules
diff --git a/xos/openstack_observer/steps/sync_slivers.py b/xos/openstack_observer/steps/sync_slivers.py
index d3df266..48f5c25 100644
--- a/xos/openstack_observer/steps/sync_slivers.py
+++ b/xos/openstack_observer/steps/sync_slivers.py
@@ -83,20 +83,19 @@
if net['name']=='public':
nics.append(net['id'])
- image_id = None
+ image_name = None
controller_images = sliver.image.controllerimages.filter(controller=sliver.node.site_deployment.controller)
if controller_images:
- image_id = controller_images[0].glance_image_id
- logger.info("using image_id from ControllerImage object: " + str(image_id))
+ image_name = controller_images[0].image.name
+ logger.info("using image from ControllerImage object: " + str(image_name))
- if image_id is None:
+ if image_name is None:
controller_driver = self.driver.admin_driver(controller=sliver.node.site_deployment.controller)
- image_id = None
images = controller_driver.shell.glanceclient.images.list()
for image in images:
- if image.name == sliver.image.name or not image_id:
- image_id = image.id
- logger.info("using image_id from glance: " + str(image_id))
+ if image.name == sliver.image.name or not image_name:
+ image_name = image.name
+ logger.info("using image from glance: " + str(image_name))
try:
legacy = Config().observer_legacy
@@ -125,8 +124,8 @@
'name':sliver_name,
'ansible_tag':sliver_name,
'availability_zone': availability_zone_filter,
- 'image_id':image_id,
- 'flavor_id':sliver.flavor.id,
+ 'image_name':image_name,
+ 'flavor_name':sliver.flavor.name,
'nics':nics,
'meta':metadata_update,
'user_data':r'%s'%escape(userData)}
diff --git a/xos/openstack_observer/steps/sync_slivers.yaml b/xos/openstack_observer/steps/sync_slivers.yaml
index 6ac995f..c543227 100644
--- a/xos/openstack_observer/steps/sync_slivers.yaml
+++ b/xos/openstack_observer/steps/sync_slivers.yaml
@@ -8,14 +8,14 @@
login_password: {{ admin_password }}
login_tenant_name: {{ admin_tenant }}
name: {{ name }}
- {% if delete %}
+ {% if delete -%}
state: absent
- {% else %}
+ {% else -%}
state: present
availability_zone: {{ availability_zone }}
- image_id: {{ image_id }}
+ image_name: {{ image_name }}
wait_for: 200
- flavor_id: {{ flavor_id }}
+ flavor_name: {{ flavor_name }}
user_data: "{{ user_data }}"
nics:
{% for net in nics %}