Commit a187bc69 authored by Ilias Tsitsimpis's avatar Ilias Tsitsimpis
Browse files

ci: turn system_uuid option into a hardcoded one

User doesn't need to specify the UUID of the owner of
system images (it's usually hard to find it).

Instead save the uuids for these users for our production and
testing deployments inside a list (DEFAULT_SYSTEM_IMAGES_UUID) and
use that (uuids never change). If you need to specify another user
it's preferable to specify the image_id using the corresponding option.
parent ca7b5a9a
...@@ -19,8 +19,6 @@ patch_pydist = True ...@@ -19,8 +19,6 @@ patch_pydist = True
# Configuration of git (on remote server) # Configuration of git (on remote server)
git_config_name = Buildbot git_config_name = Buildbot
git_config_mail = synnefo@builder.dev.grnet.gr git_config_mail = synnefo@builder.dev.grnet.gr
# Url to fetch ssh public keys
public_ssh_keys_url =
# Network address from which we allow access to server. If not set, access # Network address from which we allow access to server. If not set, access
# to server is not restricted. # to server is not restricted.
filter_access_network = filter_access_network =
...@@ -38,10 +36,6 @@ server_name = Synnefo Deployment ...@@ -38,10 +36,6 @@ server_name = Synnefo Deployment
flavor_id = 639 flavor_id = 639
# Image to use (name must contain this) # Image to use (name must contain this)
image_name = OldStable image_name = OldStable
# UUID of owner of system images
# (25ecced9-bf53-4145-91ee-cf47377e9fb2 for production,
# 04cbe33f-29b7-4ef1-94fb-015929e5fc06 for okeanos.io)
system_uuid = 04cbe33f-29b7-4ef1-94fb-015929e5fc06
[Burnin] [Burnin]
......
...@@ -19,6 +19,11 @@ from kamaki.clients.cyclades import CycladesClient ...@@ -19,6 +19,11 @@ from kamaki.clients.cyclades import CycladesClient
from kamaki.clients.image import ImageClient from kamaki.clients.image import ImageClient
DEFAULT_CONFIG_FILE = "new_config" DEFAULT_CONFIG_FILE = "new_config"
# UUID of owner of system images
DEFAULT_SYSTEM_IMAGES_UUID = [
"25ecced9-bf53-4145-91ee-cf47377e9fb2", # production (okeanos.grnet.gr)
"04cbe33f-29b7-4ef1-94fb-015929e5fc06", # testing (okeanos.io)
]
def _run(cmd, verbose): def _run(cmd, verbose):
...@@ -249,17 +254,17 @@ class SynnefoCI(object): ...@@ -249,17 +254,17 @@ class SynnefoCI(object):
def _find_image(self): def _find_image(self):
"""Find a suitable image to use """Find a suitable image to use
It has to belong to the `system_uuid' user and It has to belong to one of the `DEFAULT_SYSTEM_IMAGES_UUID'
contain the word `image_name' users and contain the word given by `image_name' option.
""" """
system_uuid = self.config.get('Deployment', 'system_uuid')
image_name = self.config.get('Deployment', 'image_name').lower() image_name = self.config.get('Deployment', 'image_name').lower()
images = self.image_client.list_public(detail=True)['images'] images = self.image_client.list_public(detail=True)['images']
# Select images by `system_uuid' user # Select images by `system_uuid' user
images = [x for x in images if x['user_id'] == system_uuid] images = [x for x in images
if x['user_id'] in DEFAULT_SYSTEM_IMAGES_UUID]
# Select images with `image_name' in their names # Select images with `image_name' in their names
images = \ images = [x for x in images
[x for x in images if x['name'].lower().find(image_name) != -1] if x['name'].lower().find(image_name) != -1]
# Let's select the first one # Let's select the first one
return images[0] return images[0]
......
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