Changed dependencies for sync_controller_images
Sapan Bhatia [Fri, 16 Jan 2015 22:12:20 +0000 (22:12 +0000)]
planetstack/openstack_observer/steps/sync_controller_images.py

index 008de71..2014a25 100644 (file)
@@ -12,7 +12,7 @@ from observer.ansible import *
 logger = Logger(level=logging.INFO)
 
 class SyncControllerImages(OpenStackSyncStep):
-    provides=[ControllerImages]
+    provides=[ControllerImages, Image]
     requested_interval=0
 
     def fetch_pending(self, deleted):
@@ -24,19 +24,19 @@ class SyncControllerImages(OpenStackSyncStep):
 
     def sync_record(self, controller_image):
         logger.info("Working on image %s on controller %s" % (controller_image.image.name, controller_image.controller))
-       image_fields = {'endpoint':controller_image.controller.auth_url,
-                       'admin_user':controller_image.controller.admin_user,
-                       'admin_password':controller_image.controller.admin_password,
-                       'name':controller_image.image.name,
-                       'filepath':controller_image.image.path,
-                       'ansible_tag': '%s@%s'%(controller_image.image.name,controller_image.controller.name), # name of ansible playbook
-                       }
+        image_fields = {'endpoint':controller_image.controller.auth_url,
+                        'admin_user':controller_image.controller.admin_user,
+                        'admin_password':controller_image.controller.admin_password,
+                        'name':controller_image.image.name,
+                        'filepath':controller_image.image.path,
+                        'ansible_tag': '%s@%s'%(controller_image.image.name,controller_image.controller.name), # name of ansible playbook
+                        }
 
-       res = run_template('sync_controller_images.yaml', image_fields, path='controller_images')
+        res = run_template('sync_controller_images.yaml', image_fields, path='controller_images')
 
-       if (len(res)!=1):
-           raise Exception('Could not sync image %s'%controller_image.image.name)
-       else:
-           image_id = res[0]['id'] 
+        if (len(res)!=1):
+            raise Exception('Could not sync image %s'%controller_image.image.name)
+        else:
+            image_id = res[0]['id']
             controller_image.glance_image_id = image_id
             controller_image.save()