GCE: Name the image as specified in the manifest

We were hard coding an image name format for GCE, but that doesn't match
what other providers (e.g. AWS) do.

Given that image upload did not work at all previously, no reason to
preserve the existing unusual behaviour.
This commit is contained in:
Justin Santa Barbara 2016-04-17 12:48:50 -04:00
parent be595efd99
commit 3036eb41c1

View file

@ -12,16 +12,8 @@ class CreateTarball(Task):
@classmethod
def run(cls, info):
import datetime
image_name = info.manifest.name.format(**info.manifest_vars)
filename = image_name + '.' + info.volume.extension
today = datetime.datetime.today()
name_suffix = today.strftime('%Y%m%d')
image_name_format = '{lsb_distribution}-{lsb_release}-{release}-v{name_suffix}'
image_name = image_name_format.format(lsb_distribution=info._gce['lsb_distribution'],
lsb_release=info._gce['lsb_release'],
release=info.manifest.system['release'],
name_suffix=name_suffix)
# ensure that we do not use disallowed characters in image name
image_name = image_name.lower()
image_name = image_name.replace(".", "-")