run_id is now in hex per default

... since its primary use is as a string
This commit is contained in:
Anders Ingemann 2013-12-28 13:56:48 +01:00
parent ba1db3b737
commit 61b5dd2ef0
3 changed files with 4 additions and 5 deletions

View file

@ -7,9 +7,8 @@ class BootstrapInformation(object):
self.volume = load_volume(self.manifest.volume) self.volume = load_volume(self.manifest.volume)
self.debug = debug self.debug = debug
import random import random
self.run_id = random.randrange(16 ** 8) self.run_id = '{id:08x}'.format(id=random.randrange(16 ** 8))
import os.path import os.path
workspace_dirname = '{id:x}'.format(id=self.run_id) self.workspace = os.path.join(manifest.bootstrapper['workspace'], self.run_id)
self.workspace = os.path.join(manifest.bootstrapper['workspace'], workspace_dirname)
self.initd = {'install': {}, 'disable': []} self.initd = {'install': {}, 'disable': []}

View file

@ -49,7 +49,7 @@ class CopyImage(Task):
predecessors = [bootstrap.Bootstrap] predecessors = [bootstrap.Bootstrap]
def run(self, info): def run(self, info):
loopback_backup_name = 'volume-{id:x}.{ext}.backup'.format(id=info.run_id, ext=info.volume.extension) loopback_backup_name = 'volume-{id}.{ext}.backup'.format(id=info.run_id, ext=info.volume.extension)
destination = os.path.join(info.manifest.bootstrapper['workspace'], loopback_backup_name) destination = os.path.join(info.manifest.bootstrapper['workspace'], loopback_backup_name)
def mk_snapshot(): def mk_snapshot():

View file

@ -45,7 +45,7 @@ class BundleImage(Task):
phase = phases.image_registration phase = phases.image_registration
def run(self, info): def run(self, info):
bundle_name = 'bundle-{id:x}'.format(id=info.run_id) bundle_name = 'bundle-{id}'.format(id=info.run_id)
info.bundle_path = os.path.join(info.workspace, bundle_name) info.bundle_path = os.path.join(info.workspace, bundle_name)
log_check_call(['/usr/bin/euca-bundle-image', log_check_call(['/usr/bin/euca-bundle-image',
'--image', info.volume.image_path, '--image', info.volume.image_path,