Commit 9d9ad424 authored by Stavros Sachtouris's avatar Stavros Sachtouris
Browse files

Stop create_server from crushing by a faulty image

If the image is missing the (os, users) metadata, the create_server method
used to crush anexpectingly
parent a863029c
......@@ -80,11 +80,10 @@ class ComputeClient(ComputeRestClient):
'imageRef': image_id}}
image = self.get_image_details(image_id)
img_meta = image['metadata']['values']
metadata = {}
for key in ('os', 'users'):
try:
metadata[key] = img_meta[key]
metadata[key] = image['metadata']['values'][key]
except KeyError:
pass
if metadata:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment