Merge pull request #34 from caglar10ur/observer
observer raises expections when phantomjs is missing
diff --git a/planetstack/openstack_observer/steps/sync_images.py b/planetstack/openstack_observer/steps/sync_images.py
index f5764a1..94cfd99 100644
--- a/planetstack/openstack_observer/steps/sync_images.py
+++ b/planetstack/openstack_observer/steps/sync_images.py
@@ -17,11 +17,14 @@
return []
# get list of images on disk
- images_path = Config().observer_images_directory
+ images_path = Config().observer_images_directory
+
available_images = {}
- for f in os.listdir(images_path):
- if os.path.isfile(os.path.join(images_path ,f)):
- available_images[f] = os.path.join(images_path ,f)
+ if os.path.exists(images_path):
+ for f in os.listdir(images_path):
+ filename = os.path.join(images_path, f)
+ if os.path.isfile(filename):
+ available_images[f] = filename
images = Image.objects.all()
image_names = [image.name for image in images]
@@ -35,8 +38,7 @@
container_format='bare',
path = available_images[image_name])
image.save()
-
-
+
return Image.objects.filter(Q(enacted__lt=F('updated')) | Q(enacted=None))
def sync_record(self, image):