Rename mount_dir to workspace

We'll be using it for a bucnh of different things in the future
This commit is contained in:
Anders Ingemann 2013-09-15 16:11:45 +02:00
parent ff7c04c120
commit 9cb4b3e375
11 changed files with 28 additions and 11 deletions

View file

@ -9,12 +9,12 @@
"bootstrapper": {
"type": "object",
"properties": {
"mount_dir": { "type": "string" },
"workspace": { "type": "string" },
"mirror": { "type": "string" },
"tarball": { "type": "boolean" },
"tarball_dir": { "type": "string" }
},
"required": ["mount_dir"]
"required": ["workspace"]
},
"system": {
"type": "object",

View file

@ -41,8 +41,8 @@ class CreateMountDir(Task):
def run(self, info):
import os
mount_dir = info.manifest.bootstrapper['mount_dir']
info.root = '{mount_dir}/{id:x}'.format(mount_dir=mount_dir, id=info.run_id)
workspace = info.manifest.bootstrapper['workspace']
info.root = '{workspace}/{id:x}'.format(workspace=workspace, id=info.run_id)
# Works recursively, fails if last part exists, which is exactly what we want.
os.makedirs(info.root)

View file

@ -13,3 +13,18 @@ class Create(Task):
import os.path
image_path = os.path.join(info.manifest.volume['loopback_dir'], loopback_filename)
info.volume.create(image_path)
class MoveImage(Task):
description = 'Moving volume image'
phase = phases.image_registration
def run(self, info):
import os.path
image_basename = os.path.basename(info.volume.image_path)
destination = os.path.join(info.manifest.bootstrapper['workspace'], image_basename)
import shutil
shutil.move(info.volume.image_path, destination)
import logging
log = logging.getLogger(__name__)
log.info('The volume image has been moved to {image_path}'.format(image_path=destination))

View file

@ -7,7 +7,7 @@
},
"bootstrapper": {
"mount_dir": "/target",
"workspace": "/target",
"mirror": "http://http.debian.net/debian"
},
"image": {

View file

@ -10,7 +10,7 @@
},
"bootstrapper": {
"mount_dir": "/target",
"workspace": "/target",
"mirror": "http://http.debian.net/debian"
},
"image": {

View file

@ -3,7 +3,7 @@
"virtualization": "virtio",
"bootstrapper": {
"mount_dir": "/mnt/target",
"workspace": "/mnt/target",
"mirror" : "http://ftp.fr.debian.org/debian/"
},
"image": {

View file

@ -3,7 +3,7 @@
"virtualization": "ide",
"bootstrapper": {
"mount_dir": "/target"
"workspace": "/target"
},
"image": {
"name" : "debian-{release}-{architecture}-{virtualization}-{%y}{%m}{%d}",

View file

@ -3,7 +3,7 @@
"virtualization": "virtio",
"bootstrapper": {
"mount_dir": "/target"
"workspace": "/target"
},
"image": {
"name" : "debian-{release}-{architecture}-{virtualization}-{%y}{%m}{%d}",

View file

@ -3,7 +3,7 @@
"virtualization": "ide",
"bootstrapper": {
"mount_dir": "/mnt/target",
"workspace": "/mnt/target",
"mirror": "http://http.debian.net/debian/"
},
"image": {

View file

@ -1,10 +1,12 @@
from base import Task
from common import phases
from common.tasks import loopback
class ConvertImage(Task):
description = 'Converting raw image'
phase = phases.image_registration
before = [loopback.MoveImage]
def run(self, info):
from common.tools import log_check_call

View file

@ -67,7 +67,7 @@ def tasks(tasklist, manifest):
partitioning.UnmapPartitions(),
volume_tasks.Detach(),
filesystem.DeleteMountDir(),
volume_tasks.Delete())
loopback.MoveImage())
if manifest.bootstrapper['tarball']:
tasklist.add(bootstrap.MakeTarball())