Skip to content

Commit

Permalink
Merge pull request #166 from googlegenomics/imagenames
Browse files Browse the repository at this point in the history
Adds support for short-hand references to GCE images
  • Loading branch information
nicolasbaer committed Jun 13, 2015
2 parents 6d2df96 + 43fd66a commit b710dc4
Showing 1 changed file with 22 additions and 2 deletions.
24 changes: 22 additions & 2 deletions elasticluster/providers/gce.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,8 +238,28 @@ def start_instance(self,
if image_id.startswith('http://') or image_id.startswith('https://'):
image_url = image_id
else:
os = image_id.split("-")[0]
os_cloud = "%s-cloud" % os
# The image names and full resource URLs for several Google-
# provided images (debian, centos, etc.) follow a consistent
# pattern, and so elasticluster supports a short-hand of just
# an image name, such as
# "debian-7-wheezy-v20150526".
# The cloud project in this case is then "debian-cloud".
#
# Several images do not follow this convention, and so are
# special-cased here:
# backports-debian -> debian-cloud
# ubuntu -> ubuntu-os-cloud
# containter-vm -> google-containers
if image_id.startswith('container-vm-'):
os_cloud = 'google-containers'
elif image_id.startswith('backports-debian-'):
os_cloud = 'debian-cloud'
elif image_id.startswith('ubuntu-'):
os_cloud = 'ubuntu-os-cloud'
else:
os = image_id.split("-")[0]
os_cloud = "%s-cloud" % os

image_url = '%s%s/global/images/%s' % (
GCE_URL, os_cloud, image_id)

Expand Down

0 comments on commit b710dc4

Please sign in to comment.