Revision 62f3f54f ci/utils.py
b/ci/utils.py | ||
---|---|---|
19 | 19 |
from kamaki.clients.image import ImageClient |
20 | 20 |
|
21 | 21 |
DEFAULT_CONFIG_FILE = "new_config" |
22 |
# UUID of owner of system images |
|
23 |
DEFAULT_SYSTEM_IMAGES_UUID = [ |
|
24 |
"25ecced9-bf53-4145-91ee-cf47377e9fb2", # production (okeanos.grnet.gr) |
|
25 |
"04cbe33f-29b7-4ef1-94fb-015929e5fc06", # testing (okeanos.io) |
|
26 |
] |
|
22 | 27 |
|
23 | 28 |
|
24 | 29 |
def _run(cmd, verbose): |
... | ... | |
249 | 254 |
def _find_image(self): |
250 | 255 |
"""Find a suitable image to use |
251 | 256 |
|
252 |
It has to belong to the `system_uuid' user and
|
|
253 |
contain the word `image_name'
|
|
257 |
It has to belong to one of the `DEFAULT_SYSTEM_IMAGES_UUID'
|
|
258 |
users and contain the word given by `image_name' option.
|
|
254 | 259 |
""" |
255 |
system_uuid = self.config.get('Deployment', 'system_uuid') |
|
256 | 260 |
image_name = self.config.get('Deployment', 'image_name').lower() |
257 | 261 |
images = self.image_client.list_public(detail=True)['images'] |
258 | 262 |
# Select images by `system_uuid' user |
259 |
images = [x for x in images if x['user_id'] == system_uuid] |
|
263 |
images = [x for x in images |
|
264 |
if x['user_id'] in DEFAULT_SYSTEM_IMAGES_UUID] |
|
260 | 265 |
# Select images with `image_name' in their names |
261 |
images = \
|
|
262 |
[x for x in images if x['name'].lower().find(image_name) != -1]
|
|
266 |
images = [x for x in images
|
|
267 |
if x['name'].lower().find(image_name) != -1]
|
|
263 | 268 |
# Let's select the first one |
264 | 269 |
return images[0] |
265 | 270 |
|
Also available in: Unified diff