mirror of
https://github.com/kevingruesser/bootstrap-vz.git
synced 2025-08-22 18:00:35 +00:00
Systematically use rel_path for relative paths
This commit is contained in:
parent
d8c831a7fa
commit
90da634226
47 changed files with 110 additions and 164 deletions
|
@ -12,12 +12,10 @@ def validate_manifest(data, validator, error):
|
||||||
:param function validator: The function that validates the manifest given the data and a path
|
:param function validator: The function that validates the manifest given the data and a path
|
||||||
:param function error: The function tha raises an error when the validation fails
|
:param function error: The function tha raises an error when the validation fails
|
||||||
"""
|
"""
|
||||||
import os.path
|
from bootstrapvz.common.tools import rel_path
|
||||||
schema_path = os.path.normpath(os.path.join(os.path.dirname(__file__), 'manifest-schema.yml'))
|
validator(data, rel_path(__file__, 'manifest-schema.yml'))
|
||||||
validator(data, schema_path)
|
|
||||||
|
|
||||||
from bootstrapvz.common.releases import get_release
|
from bootstrapvz.common.releases import get_release, squeeze
|
||||||
from bootstrapvz.common.releases import squeeze
|
|
||||||
release = get_release(data['system']['release'])
|
release = get_release(data['system']['release'])
|
||||||
|
|
||||||
if release < squeeze:
|
if release < squeeze:
|
||||||
|
|
|
@ -3,7 +3,7 @@ to determine which tasks should be added to the tasklist, what arguments various
|
||||||
invocations should have etc..
|
invocations should have etc..
|
||||||
"""
|
"""
|
||||||
from bootstrapvz.common.exceptions import ManifestError
|
from bootstrapvz.common.exceptions import ManifestError
|
||||||
from bootstrapvz.common.tools import load_data
|
from bootstrapvz.common.tools import load_data, rel_path
|
||||||
import logging
|
import logging
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
@ -28,9 +28,7 @@ class Manifest(object):
|
||||||
raise ManifestError('`path\' or `data\' must be provided')
|
raise ManifestError('`path\' or `data\' must be provided')
|
||||||
self.path = path
|
self.path = path
|
||||||
|
|
||||||
import os.path
|
self.metaschema = load_data(rel_path(__file__, 'metaschema.json'))
|
||||||
self.metaschema = load_data(os.path.normpath(os.path.join(os.path.dirname(__file__),
|
|
||||||
'metaschema.json')))
|
|
||||||
|
|
||||||
self.load_data(data)
|
self.load_data(data)
|
||||||
self.load_modules()
|
self.load_modules()
|
||||||
|
|
|
@ -128,22 +128,22 @@ def get_all_tasks(loaded_modules):
|
||||||
import pkgutil
|
import pkgutil
|
||||||
import os.path
|
import os.path
|
||||||
import bootstrapvz
|
import bootstrapvz
|
||||||
bootstrapvz_root = os.path.dirname(bootstrapvz.__file__)
|
from bootstrapvz.common.tools import rel_path
|
||||||
module_paths = set([(os.path.join(bootstrapvz_root, 'common/tasks'), 'bootstrapvz.common.tasks.')])
|
module_paths = set([(rel_path(bootstrapvz.__file__, 'common/tasks'), 'bootstrapvz.common.tasks.')])
|
||||||
|
|
||||||
for module in loaded_modules:
|
for module in loaded_modules:
|
||||||
module_path = os.path.dirname(module.__file__)
|
module_path = os.path.dirname(module.__file__)
|
||||||
module_prefix = module.__name__ + '.'
|
module_prefix = module.__name__ + '.'
|
||||||
module_paths.add((module_path, module_prefix))
|
module_paths.add((module_path, module_prefix))
|
||||||
|
|
||||||
providers = os.path.join(os.path.dirname(bootstrapvz.__file__), 'providers')
|
providers = rel_path(bootstrapvz.__file__, 'providers')
|
||||||
for module_loader, module_name, ispkg in pkgutil.iter_modules([providers, 'bootstrapvz.providers']):
|
for module_loader, module_name, ispkg in pkgutil.iter_modules([providers, 'bootstrapvz.providers']):
|
||||||
module_path = os.path.join(module_loader.path, module_name)
|
module_path = os.path.join(module_loader.path, module_name)
|
||||||
# The prefix param seems to do nothing, so we prefix the module name ourselves
|
# The prefix param seems to do nothing, so we prefix the module name ourselves
|
||||||
module_prefix = 'bootstrapvz.providers.{}.'.format(module_name)
|
module_prefix = 'bootstrapvz.providers.{}.'.format(module_name)
|
||||||
module_paths.add((module_path, module_prefix))
|
module_paths.add((module_path, module_prefix))
|
||||||
|
|
||||||
plugins = os.path.join(os.path.dirname(bootstrapvz.__file__), 'plugins')
|
plugins = rel_path(bootstrapvz.__file__, 'plugins')
|
||||||
for module_loader, module_name, ispkg in pkgutil.iter_modules([plugins, 'bootstrapvz.plugins']):
|
for module_loader, module_name, ispkg in pkgutil.iter_modules([plugins, 'bootstrapvz.plugins']):
|
||||||
module_path = os.path.join(module_loader.path, module_name)
|
module_path = os.path.join(module_loader.path, module_name)
|
||||||
module_prefix = 'bootstrapvz.plugins.{}.'.format(module_name)
|
module_prefix = 'bootstrapvz.plugins.{}.'.format(module_name)
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
import os.path
|
from bootstrapvz.common.tools import rel_path
|
||||||
|
|
||||||
assets = os.path.normpath(os.path.join(os.path.dirname(__file__), '../assets'))
|
assets = rel_path(__file__, '../assets')
|
||||||
|
|
|
@ -45,8 +45,8 @@ class ConfigureNetworkIF(Task):
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def run(cls, info):
|
def run(cls, info):
|
||||||
network_config_path = os.path.join(os.path.dirname(__file__), 'network-configuration.yml')
|
from ..tools import config_get, rel_path
|
||||||
from ..tools import config_get
|
network_config_path = rel_path(__file__, 'network-configuration.yml')
|
||||||
if_config = config_get(network_config_path, [info.manifest.release.codename])
|
if_config = config_get(network_config_path, [info.manifest.release.codename])
|
||||||
|
|
||||||
interfaces_path = os.path.join(info.root, 'etc/network/interfaces')
|
interfaces_path = os.path.join(info.root, 'etc/network/interfaces')
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
def validate_manifest(data, validator, error):
|
def validate_manifest(data, validator, error):
|
||||||
import os.path
|
from bootstrapvz.common.tools import rel_path
|
||||||
|
validator(data, rel_path(__file__, 'manifest-schema.yml'))
|
||||||
schema_path = os.path.normpath(os.path.join(os.path.dirname(__file__), 'manifest-schema.yml'))
|
|
||||||
validator(data, schema_path)
|
|
||||||
|
|
||||||
|
|
||||||
def resolve_tasks(taskset, manifest):
|
def resolve_tasks(taskset, manifest):
|
||||||
|
|
|
@ -2,9 +2,8 @@ import tasks
|
||||||
|
|
||||||
|
|
||||||
def validate_manifest(data, validator, error):
|
def validate_manifest(data, validator, error):
|
||||||
import os.path
|
from bootstrapvz.common.tools import rel_path
|
||||||
schema_path = os.path.normpath(os.path.join(os.path.dirname(__file__), 'manifest-schema.yml'))
|
validator(data, rel_path(__file__, 'manifest-schema.yml'))
|
||||||
validator(data, schema_path)
|
|
||||||
|
|
||||||
|
|
||||||
def resolve_tasks(taskset, manifest):
|
def resolve_tasks(taskset, manifest):
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
def validate_manifest(data, validator, error):
|
def validate_manifest(data, validator, error):
|
||||||
import os.path
|
from bootstrapvz.common.tools import rel_path
|
||||||
schema_path = os.path.normpath(os.path.join(os.path.dirname(__file__), 'manifest-schema.yml'))
|
validator(data, rel_path(__file__, 'manifest-schema.yml'))
|
||||||
validator(data, schema_path)
|
|
||||||
|
|
||||||
|
|
||||||
def resolve_tasks(taskset, manifest):
|
def resolve_tasks(taskset, manifest):
|
||||||
|
|
|
@ -2,9 +2,8 @@ import tasks
|
||||||
|
|
||||||
|
|
||||||
def validate_manifest(data, validator, error):
|
def validate_manifest(data, validator, error):
|
||||||
import os.path
|
from bootstrapvz.common.tools import rel_path
|
||||||
schema_path = os.path.normpath(os.path.join(os.path.dirname(__file__), 'manifest-schema.yml'))
|
validator(data, rel_path(__file__, 'manifest-schema.yml'))
|
||||||
validator(data, schema_path)
|
|
||||||
|
|
||||||
|
|
||||||
def resolve_tasks(taskset, manifest):
|
def resolve_tasks(taskset, manifest):
|
||||||
|
|
|
@ -1,9 +1,8 @@
|
||||||
|
|
||||||
|
|
||||||
def validate_manifest(data, validator, error):
|
def validate_manifest(data, validator, error):
|
||||||
import os.path
|
from bootstrapvz.common.tools import rel_path
|
||||||
schema_path = os.path.normpath(os.path.join(os.path.dirname(__file__), 'manifest-schema.yml'))
|
validator(data, rel_path(__file__, 'manifest-schema.yml'))
|
||||||
validator(data, schema_path)
|
|
||||||
|
|
||||||
|
|
||||||
def resolve_tasks(taskset, manifest):
|
def resolve_tasks(taskset, manifest):
|
||||||
|
|
|
@ -1,9 +1,8 @@
|
||||||
|
|
||||||
|
|
||||||
def validate_manifest(data, validator, error):
|
def validate_manifest(data, validator, error):
|
||||||
import os.path
|
from bootstrapvz.common.tools import rel_path
|
||||||
schema_path = os.path.normpath(os.path.join(os.path.dirname(__file__), 'manifest-schema.yml'))
|
validator(data, rel_path(__file__, 'manifest-schema.yml'))
|
||||||
validator(data, schema_path)
|
|
||||||
|
|
||||||
|
|
||||||
def resolve_tasks(taskset, manifest):
|
def resolve_tasks(taskset, manifest):
|
||||||
|
|
|
@ -1,9 +1,7 @@
|
||||||
def validate_manifest(data, validator, error):
|
def validate_manifest(data, validator, error):
|
||||||
from bootstrapvz.common.tools import log_check_call
|
from bootstrapvz.common.tools import log_check_call, rel_path
|
||||||
import os.path
|
validator(data, rel_path(__file__, 'manifest-schema.yml'))
|
||||||
schema_path = os.path.join(os.path.dirname(__file__),
|
|
||||||
'schema.yaml')
|
|
||||||
validator(data, schema_path)
|
|
||||||
log_check_call(['debconf-set-selections', '--checkonly'],
|
log_check_call(['debconf-set-selections', '--checkonly'],
|
||||||
stdin=data['plugins']['debconf'])
|
stdin=data['plugins']['debconf'])
|
||||||
|
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
import os.path
|
from bootstrapvz.common.tools import rel_path
|
||||||
import tasks
|
import tasks
|
||||||
from bootstrapvz.common.tasks import apt
|
from bootstrapvz.common.tasks import apt
|
||||||
from bootstrapvz.common.releases import wheezy
|
from bootstrapvz.common.releases import wheezy
|
||||||
|
|
||||||
|
|
||||||
def validate_manifest(data, validator, error):
|
def validate_manifest(data, validator, error):
|
||||||
schema_path = os.path.normpath(os.path.join(os.path.dirname(__file__), 'manifest-schema.yml'))
|
validator(data, rel_path(__file__, 'manifest-schema.yml'))
|
||||||
validator(data, schema_path)
|
|
||||||
from bootstrapvz.common.releases import get_release
|
from bootstrapvz.common.releases import get_release
|
||||||
if get_release(data['system']['release']) == wheezy:
|
if get_release(data['system']['release']) == wheezy:
|
||||||
# prefs is a generator of apt preferences across files in the manifest
|
# prefs is a generator of apt preferences across files in the manifest
|
||||||
|
|
|
@ -2,15 +2,14 @@ from bootstrapvz.base import Task
|
||||||
from bootstrapvz.common import phases
|
from bootstrapvz.common import phases
|
||||||
from bootstrapvz.common.tasks import grub
|
from bootstrapvz.common.tasks import grub
|
||||||
from bootstrapvz.common.tasks import initd
|
from bootstrapvz.common.tasks import initd
|
||||||
from bootstrapvz.common.tools import log_check_call
|
from bootstrapvz.common.tools import log_check_call, sed_i, rel_path
|
||||||
from bootstrapvz.common.tools import sed_i
|
|
||||||
import os
|
import os
|
||||||
import os.path
|
import os.path
|
||||||
import shutil
|
import shutil
|
||||||
import subprocess
|
import subprocess
|
||||||
import time
|
import time
|
||||||
|
|
||||||
ASSETS_DIR = os.path.normpath(os.path.join(os.path.dirname(__file__), 'assets'))
|
ASSETS_DIR = rel_path(__file__, 'assets')
|
||||||
|
|
||||||
|
|
||||||
class AddDockerDeps(Task):
|
class AddDockerDeps(Task):
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
def validate_manifest(data, validator, error):
|
def validate_manifest(data, validator, error):
|
||||||
import os.path
|
from bootstrapvz.common.tools import rel_path
|
||||||
schema_path = os.path.normpath(os.path.join(os.path.dirname(__file__), 'manifest-schema.yml'))
|
validator(data, rel_path(__file__, 'manifest-schema.yml'))
|
||||||
validator(data, schema_path)
|
|
||||||
|
|
||||||
|
|
||||||
def resolve_tasks(taskset, manifest):
|
def resolve_tasks(taskset, manifest):
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
def validate_manifest(data, validator, error):
|
def validate_manifest(data, validator, error):
|
||||||
import os.path
|
from bootstrapvz.common.tools import rel_path
|
||||||
schema_path = os.path.normpath(os.path.join(os.path.dirname(__file__), 'manifest-schema.yml'))
|
validator(data, rel_path(__file__, 'manifest-schema.yml'))
|
||||||
validator(data, schema_path)
|
|
||||||
|
|
||||||
|
|
||||||
def resolve_tasks(taskset, manifest):
|
def resolve_tasks(taskset, manifest):
|
||||||
|
|
|
@ -2,10 +2,9 @@ import tasks
|
||||||
|
|
||||||
|
|
||||||
def validate_manifest(data, validator, error):
|
def validate_manifest(data, validator, error):
|
||||||
import os.path
|
from bootstrapvz.common.tools import rel_path
|
||||||
|
|
||||||
schema_path = os.path.normpath(os.path.join(os.path.dirname(__file__), 'manifest-schema.yml'))
|
validator(data, rel_path(__file__, 'manifest-schema.yml'))
|
||||||
validator(data, schema_path)
|
|
||||||
|
|
||||||
|
|
||||||
def resolve_tasks(taskset, manifest):
|
def resolve_tasks(taskset, manifest):
|
||||||
|
|
|
@ -1,10 +1,9 @@
|
||||||
import tasks
|
import tasks
|
||||||
import os.path
|
from bootstrapvz.common.tools import rel_path
|
||||||
|
|
||||||
|
|
||||||
def validate_manifest(data, validator, error):
|
def validate_manifest(data, validator, error):
|
||||||
schema_path = os.path.normpath(os.path.join(os.path.dirname(__file__), 'manifest-schema.yml'))
|
validator(data, rel_path(__file__, 'manifest-schema.yml'))
|
||||||
validator(data, schema_path)
|
|
||||||
|
|
||||||
|
|
||||||
def resolve_tasks(taskset, manifest):
|
def resolve_tasks(taskset, manifest):
|
||||||
|
|
|
@ -6,9 +6,9 @@ from bootstrapvz.common.tasks import locale
|
||||||
|
|
||||||
|
|
||||||
def validate_manifest(data, validator, error):
|
def validate_manifest(data, validator, error):
|
||||||
import os.path
|
from bootstrapvz.common.tools import rel_path
|
||||||
schema_path = os.path.join(os.path.dirname(__file__), 'manifest-schema.yml')
|
validator(data, rel_path(__file__, 'manifest-schema.yml'))
|
||||||
validator(data, schema_path)
|
|
||||||
if data['plugins']['minimize_size'].get('shrink', False) and data['volume']['backing'] != 'vmdk':
|
if data['plugins']['minimize_size'].get('shrink', False) and data['volume']['backing'] != 'vmdk':
|
||||||
error('Can only shrink vmdk images', ['plugins', 'minimize_size', 'shrink'])
|
error('Can only shrink vmdk images', ['plugins', 'minimize_size', 'shrink'])
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
import os
|
from bootstrapvz.common.tools import rel_path
|
||||||
|
|
||||||
assets = os.path.normpath(os.path.join(os.path.dirname(__file__), '../assets'))
|
assets = rel_path(__file__, '../assets')
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
def validate_manifest(data, validator, error):
|
def validate_manifest(data, validator, error):
|
||||||
import os.path
|
from bootstrapvz.common.tools import rel_path
|
||||||
schema_path = os.path.normpath(os.path.join(os.path.dirname(__file__), 'manifest-schema.yml'))
|
validator(data, rel_path(__file__, 'manifest-schema.yml'))
|
||||||
validator(data, schema_path)
|
|
||||||
|
|
||||||
|
|
||||||
def resolve_tasks(taskset, manifest):
|
def resolve_tasks(taskset, manifest):
|
||||||
|
|
|
@ -2,9 +2,8 @@ import tasks
|
||||||
|
|
||||||
|
|
||||||
def validate_manifest(data, validator, error):
|
def validate_manifest(data, validator, error):
|
||||||
import os.path
|
from bootstrapvz.common.tools import rel_path
|
||||||
schema_path = os.path.normpath(os.path.join(os.path.dirname(__file__), 'manifest-schema.yml'))
|
validator(data, rel_path(__file__, 'manifest-schema.yml'))
|
||||||
validator(data, schema_path)
|
|
||||||
|
|
||||||
|
|
||||||
def resolve_tasks(taskset, manifest):
|
def resolve_tasks(taskset, manifest):
|
||||||
|
|
|
@ -13,9 +13,8 @@ from bootstrapvz.common.tasks import partitioning
|
||||||
|
|
||||||
|
|
||||||
def validate_manifest(data, validator, error):
|
def validate_manifest(data, validator, error):
|
||||||
import os.path
|
from bootstrapvz.common.tools import rel_path
|
||||||
schema_path = os.path.normpath(os.path.join(os.path.dirname(__file__), 'manifest-schema.yml'))
|
validator(data, rel_path(__file__, 'manifest-schema.yml'))
|
||||||
validator(data, schema_path)
|
|
||||||
|
|
||||||
|
|
||||||
def resolve_tasks(taskset, manifest):
|
def resolve_tasks(taskset, manifest):
|
||||||
|
|
|
@ -2,9 +2,8 @@ import tasks
|
||||||
|
|
||||||
|
|
||||||
def validate_manifest(data, validator, error):
|
def validate_manifest(data, validator, error):
|
||||||
import os.path
|
from bootstrapvz.common.tools import rel_path
|
||||||
schema_path = os.path.normpath(os.path.join(os.path.dirname(__file__), 'manifest-schema.yml'))
|
validator(data, rel_path(__file__, 'manifest-schema.yml'))
|
||||||
validator(data, schema_path)
|
|
||||||
|
|
||||||
|
|
||||||
def resolve_tasks(taskset, manifest):
|
def resolve_tasks(taskset, manifest):
|
||||||
|
|
|
@ -1,9 +1,8 @@
|
||||||
|
|
||||||
|
|
||||||
def validate_manifest(data, validator, error):
|
def validate_manifest(data, validator, error):
|
||||||
import os.path
|
from bootstrapvz.common.tools import rel_path
|
||||||
schema_path = os.path.normpath(os.path.join(os.path.dirname(__file__), 'manifest-schema.yml'))
|
validator(data, rel_path(__file__, 'manifest-schema.yml'))
|
||||||
validator(data, schema_path)
|
|
||||||
|
|
||||||
|
|
||||||
def resolve_tasks(taskset, manifest):
|
def resolve_tasks(taskset, manifest):
|
||||||
|
|
|
@ -2,9 +2,8 @@ import tasks
|
||||||
|
|
||||||
|
|
||||||
def validate_manifest(data, validator, error):
|
def validate_manifest(data, validator, error):
|
||||||
import os.path
|
from bootstrapvz.common.tools import rel_path
|
||||||
schema_path = os.path.normpath(os.path.join(os.path.dirname(__file__), 'manifest-schema.yml'))
|
validator(data, rel_path(__file__, 'manifest-schema.yml'))
|
||||||
validator(data, schema_path)
|
|
||||||
|
|
||||||
|
|
||||||
def resolve_tasks(taskset, manifest):
|
def resolve_tasks(taskset, manifest):
|
||||||
|
|
|
@ -1,9 +1,8 @@
|
||||||
|
|
||||||
|
|
||||||
def validate_manifest(data, validator, error):
|
def validate_manifest(data, validator, error):
|
||||||
import os.path
|
from bootstrapvz.common.tools import rel_path
|
||||||
schema_path = os.path.normpath(os.path.join(os.path.dirname(__file__), 'manifest-schema.yml'))
|
validator(data, rel_path(__file__, 'manifest-schema.yml'))
|
||||||
validator(data, schema_path)
|
|
||||||
|
|
||||||
|
|
||||||
def resolve_tasks(taskset, manifest):
|
def resolve_tasks(taskset, manifest):
|
||||||
|
|
|
@ -1,14 +1,11 @@
|
||||||
import tasks
|
import tasks
|
||||||
from bootstrapvz.common import task_groups
|
from bootstrapvz.common import task_groups
|
||||||
from bootstrapvz.common.tasks import image
|
from bootstrapvz.common.tasks import image, ssh, volume
|
||||||
from bootstrapvz.common.tasks import ssh
|
from bootstrapvz.common.tools import rel_path
|
||||||
from bootstrapvz.common.tasks import volume
|
|
||||||
import os
|
|
||||||
|
|
||||||
|
|
||||||
def validate_manifest(data, validator, error):
|
def validate_manifest(data, validator, error):
|
||||||
schema_path = os.path.normpath(os.path.join(os.path.dirname(__file__), 'manifest-schema.yml'))
|
validator(data, rel_path(__file__, 'manifest-schema.yml'))
|
||||||
validator(data, schema_path)
|
|
||||||
|
|
||||||
|
|
||||||
def resolve_tasks(taskset, manifest):
|
def resolve_tasks(taskset, manifest):
|
||||||
|
|
|
@ -1,10 +1,11 @@
|
||||||
from bootstrapvz.base import Task
|
from bootstrapvz.base import Task
|
||||||
from bootstrapvz.common import phases
|
from bootstrapvz.common import phases
|
||||||
from bootstrapvz.common.tasks import workspace
|
from bootstrapvz.common.tasks import workspace
|
||||||
|
from bootstrapvz.common.tools import rel_path
|
||||||
import os
|
import os
|
||||||
import shutil
|
import shutil
|
||||||
|
|
||||||
assets = os.path.normpath(os.path.join(os.path.dirname(__file__), 'assets'))
|
assets = rel_path(__file__, 'assets')
|
||||||
|
|
||||||
|
|
||||||
class CheckBoxPath(Task):
|
class CheckBoxPath(Task):
|
||||||
|
|
|
@ -10,9 +10,8 @@ from bootstrapvz.common.tasks import grub
|
||||||
|
|
||||||
|
|
||||||
def validate_manifest(data, validator, error):
|
def validate_manifest(data, validator, error):
|
||||||
import os.path
|
from bootstrapvz.common.tools import rel_path
|
||||||
schema_path = os.path.normpath(os.path.join(os.path.dirname(__file__), 'manifest-schema.yml'))
|
validator(data, rel_path(__file__, 'manifest-schema.yml'))
|
||||||
validator(data, schema_path)
|
|
||||||
|
|
||||||
|
|
||||||
def resolve_tasks(taskset, manifest):
|
def resolve_tasks(taskset, manifest):
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
import os.path
|
from bootstrapvz.common.tools import rel_path
|
||||||
|
|
||||||
assets = os.path.normpath(os.path.join(os.path.dirname(__file__), '../assets'))
|
assets = rel_path(__file__, '../assets')
|
||||||
|
|
|
@ -15,9 +15,8 @@ class DefaultPackages(Task):
|
||||||
info.packages.add('sudo')
|
info.packages.add('sudo')
|
||||||
info.packages.add('parted')
|
info.packages.add('parted')
|
||||||
|
|
||||||
import os.path
|
from bootstrapvz.common.tools import config_get, rel_path
|
||||||
kernel_packages_path = os.path.join(os.path.dirname(__file__), 'packages-kernels.yml')
|
kernel_packages_path = rel_path(__file__, 'packages-kernels.yml')
|
||||||
from bootstrapvz.common.tools import config_get
|
|
||||||
kernel_package = config_get(kernel_packages_path, [info.manifest.release.codename,
|
kernel_package = config_get(kernel_packages_path, [info.manifest.release.codename,
|
||||||
info.manifest.system['architecture']])
|
info.manifest.system['architecture']])
|
||||||
info.packages.add(kernel_package)
|
info.packages.add(kernel_package)
|
||||||
|
|
|
@ -1,14 +1,12 @@
|
||||||
from bootstrapvz.common.tasks import apt
|
|
||||||
from bootstrapvz.common.tasks import folder
|
|
||||||
from bootstrapvz.common.tasks import filesystem
|
|
||||||
from bootstrapvz.common import task_groups
|
from bootstrapvz.common import task_groups
|
||||||
|
from bootstrapvz.common.tasks import apt, folder, filesystem
|
||||||
|
from bootstrapvz.common.tools import rel_path
|
||||||
import tasks.commands
|
import tasks.commands
|
||||||
import tasks.image
|
import tasks.image
|
||||||
|
|
||||||
|
|
||||||
def validate_manifest(data, validator, error):
|
def validate_manifest(data, validator, error):
|
||||||
import os.path
|
schema_path = rel_path(__file__, 'manifest-schema.yml')
|
||||||
schema_path = os.path.normpath(os.path.join(os.path.dirname(__file__), 'manifest-schema.yml'))
|
|
||||||
validator(data, schema_path)
|
validator(data, schema_path)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -9,19 +9,13 @@ import tasks.boot
|
||||||
import tasks.network
|
import tasks.network
|
||||||
import tasks.initd
|
import tasks.initd
|
||||||
import tasks.tuning
|
import tasks.tuning
|
||||||
from bootstrapvz.common.tasks import volume
|
from bootstrapvz.common.tasks import apt, boot, filesystem, grub, initd
|
||||||
from bootstrapvz.common.tasks import filesystem
|
from bootstrapvz.common.tasks import kernel, loopback, volume
|
||||||
from bootstrapvz.common.tasks import boot
|
from bootstrapvz.common.tools import rel_path
|
||||||
from bootstrapvz.common.tasks import grub
|
|
||||||
from bootstrapvz.common.tasks import initd
|
|
||||||
from bootstrapvz.common.tasks import loopback
|
|
||||||
from bootstrapvz.common.tasks import kernel
|
|
||||||
from bootstrapvz.common.tasks import apt
|
|
||||||
|
|
||||||
|
|
||||||
def validate_manifest(data, validator, error):
|
def validate_manifest(data, validator, error):
|
||||||
import os.path
|
validator(data, rel_path(__file__, 'manifest-schema.yml'))
|
||||||
validator(data, os.path.join(os.path.dirname(__file__), 'manifest-schema.yml'))
|
|
||||||
|
|
||||||
from bootstrapvz.common.bytes import Bytes
|
from bootstrapvz.common.bytes import Bytes
|
||||||
if data['volume']['backing'] == 'ebs':
|
if data['volume']['backing'] == 'ebs':
|
||||||
|
@ -33,7 +27,7 @@ def validate_manifest(data, validator, error):
|
||||||
msg = ('The volume size must be a multiple of 1GiB when using EBS backing')
|
msg = ('The volume size must be a multiple of 1GiB when using EBS backing')
|
||||||
error(msg, ['volume', 'partitions'])
|
error(msg, ['volume', 'partitions'])
|
||||||
else:
|
else:
|
||||||
validator(data, os.path.join(os.path.dirname(__file__), 'manifest-schema-s3.yml'))
|
validator(data, rel_path(__file__, 'manifest-schema-s3.yml'))
|
||||||
|
|
||||||
bootloader = data['system']['bootloader']
|
bootloader = data['system']['bootloader']
|
||||||
virtualization = data['provider']['virtualization']
|
virtualization = data['provider']['virtualization']
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
import os.path
|
from bootstrapvz.common.tools import rel_path
|
||||||
|
|
||||||
assets = os.path.normpath(os.path.join(os.path.dirname(__file__), '../assets'))
|
assets = rel_path(__file__, '../assets')
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
from bootstrapvz.base import Task
|
from bootstrapvz.base import Task
|
||||||
from bootstrapvz.common import phases
|
from bootstrapvz.common import phases
|
||||||
from bootstrapvz.common.exceptions import TaskError
|
from bootstrapvz.common.exceptions import TaskError
|
||||||
from bootstrapvz.common.tools import log_check_call
|
from bootstrapvz.common.tools import log_check_call, rel_path
|
||||||
from ebs import Snapshot
|
from ebs import Snapshot
|
||||||
from bootstrapvz.common.tasks import workspace
|
from bootstrapvz.common.tasks import workspace
|
||||||
import connection
|
import connection
|
||||||
|
@ -116,7 +116,7 @@ class RegisterAMI(Task):
|
||||||
registration_params['virtualization_type'] = 'hvm'
|
registration_params['virtualization_type'] = 'hvm'
|
||||||
else:
|
else:
|
||||||
registration_params['virtualization_type'] = 'paravirtual'
|
registration_params['virtualization_type'] = 'paravirtual'
|
||||||
akis_path = os.path.join(os.path.dirname(__file__), 'ami-akis.yml')
|
akis_path = rel_path(__file__, 'ami-akis.yml')
|
||||||
from bootstrapvz.common.tools import config_get
|
from bootstrapvz.common.tools import config_get
|
||||||
registration_params['kernel_id'] = config_get(akis_path, [info._ec2['region'],
|
registration_params['kernel_id'] = config_get(akis_path, [info._ec2['region'],
|
||||||
info.manifest.system['architecture']])
|
info.manifest.system['architecture']])
|
||||||
|
|
|
@ -9,9 +9,10 @@ class DefaultPackages(Task):
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def run(cls, info):
|
def run(cls, info):
|
||||||
|
from bootstrapvz.common.tools import rel_path
|
||||||
info.packages.add('file') # Needed for the init scripts
|
info.packages.add('file') # Needed for the init scripts
|
||||||
|
|
||||||
kernel_packages_path = os.path.join(os.path.dirname(__file__), 'packages-kernels.yml')
|
kernel_packages_path = rel_path(__file__, 'packages-kernels.yml')
|
||||||
from bootstrapvz.common.tools import config_get
|
from bootstrapvz.common.tools import config_get
|
||||||
kernel_package = config_get(kernel_packages_path, [info.manifest.release.codename,
|
kernel_package = config_get(kernel_packages_path, [info.manifest.release.codename,
|
||||||
info.manifest.system['architecture']])
|
info.manifest.system['architecture']])
|
||||||
|
|
|
@ -6,20 +6,13 @@ import tasks.image
|
||||||
import tasks.initd
|
import tasks.initd
|
||||||
import tasks.host
|
import tasks.host
|
||||||
import tasks.packages
|
import tasks.packages
|
||||||
from bootstrapvz.common.tasks import apt
|
from bootstrapvz.common.tasks import apt, boot, image, loopback, initd
|
||||||
from bootstrapvz.common.tasks import boot
|
from bootstrapvz.common.tasks import ssh, volume, grub
|
||||||
from bootstrapvz.common.tasks import image
|
|
||||||
from bootstrapvz.common.tasks import loopback
|
|
||||||
from bootstrapvz.common.tasks import initd
|
|
||||||
from bootstrapvz.common.tasks import ssh
|
|
||||||
from bootstrapvz.common.tasks import volume
|
|
||||||
from bootstrapvz.common.tasks import grub
|
|
||||||
|
|
||||||
|
|
||||||
def validate_manifest(data, validator, error):
|
def validate_manifest(data, validator, error):
|
||||||
import os.path
|
from bootstrapvz.common.tools import rel_path
|
||||||
schema_path = os.path.normpath(os.path.join(os.path.dirname(__file__), 'manifest-schema.yml'))
|
validator(data, rel_path(__file__, 'manifest-schema.yml'))
|
||||||
validator(data, schema_path)
|
|
||||||
|
|
||||||
|
|
||||||
def resolve_tasks(taskset, manifest):
|
def resolve_tasks(taskset, manifest):
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
from bootstrapvz.base import Task
|
from bootstrapvz.base import Task
|
||||||
from bootstrapvz.common import phases
|
from bootstrapvz.common import phases
|
||||||
from bootstrapvz.common.tasks import packages
|
from bootstrapvz.common.tasks import packages
|
||||||
from bootstrapvz.common.tools import config_get
|
from bootstrapvz.common.tools import config_get, rel_path
|
||||||
import os
|
|
||||||
|
|
||||||
|
|
||||||
class DefaultPackages(Task):
|
class DefaultPackages(Task):
|
||||||
|
@ -29,7 +28,7 @@ class DefaultPackages(Task):
|
||||||
info.packages.add('sudo')
|
info.packages.add('sudo')
|
||||||
info.packages.add('uuid-runtime')
|
info.packages.add('uuid-runtime')
|
||||||
|
|
||||||
kernel_packages_path = os.path.join(os.path.dirname(__file__), 'packages-kernels.yml')
|
kernel_packages_path = rel_path(__file__, 'packages-kernels.yml')
|
||||||
kernel_package = config_get(kernel_packages_path, [info.manifest.release.codename,
|
kernel_package = config_get(kernel_packages_path, [info.manifest.release.codename,
|
||||||
info.manifest.system['architecture']])
|
info.manifest.system['architecture']])
|
||||||
info.packages.add(kernel_package)
|
info.packages.add(kernel_package)
|
||||||
|
|
|
@ -1,15 +1,11 @@
|
||||||
from bootstrapvz.common import task_groups
|
from bootstrapvz.common import task_groups
|
||||||
import tasks.packages
|
import tasks.packages
|
||||||
from bootstrapvz.common.tasks import image
|
from bootstrapvz.common.tasks import image, loopback, initd, ssh
|
||||||
from bootstrapvz.common.tasks import loopback
|
|
||||||
from bootstrapvz.common.tasks import initd
|
|
||||||
from bootstrapvz.common.tasks import ssh
|
|
||||||
|
|
||||||
|
|
||||||
def validate_manifest(data, validator, error):
|
def validate_manifest(data, validator, error):
|
||||||
import os.path
|
from bootstrapvz.common.tools import rel_path
|
||||||
schema_path = os.path.normpath(os.path.join(os.path.dirname(__file__), 'manifest-schema.yml'))
|
validator(data, rel_path(__file__, 'manifest-schema.yml'))
|
||||||
validator(data, schema_path)
|
|
||||||
|
|
||||||
|
|
||||||
def resolve_tasks(taskset, manifest):
|
def resolve_tasks(taskset, manifest):
|
||||||
|
|
|
@ -8,9 +8,8 @@ class DefaultPackages(Task):
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def run(cls, info):
|
def run(cls, info):
|
||||||
import os.path
|
from bootstrapvz.common.tools import config_get, rel_path
|
||||||
kernel_packages_path = os.path.join(os.path.dirname(__file__), 'packages-kernels.yml')
|
kernel_packages_path = rel_path(__file__, 'packages-kernels.yml')
|
||||||
from bootstrapvz.common.tools import config_get
|
|
||||||
kernel_package = config_get(kernel_packages_path, [info.manifest.release.codename,
|
kernel_package = config_get(kernel_packages_path, [info.manifest.release.codename,
|
||||||
info.manifest.system['architecture']])
|
info.manifest.system['architecture']])
|
||||||
info.packages.add(kernel_package)
|
info.packages.add(kernel_package)
|
||||||
|
|
|
@ -1,8 +1,5 @@
|
||||||
from bootstrapvz.common import task_groups
|
from bootstrapvz.common import task_groups
|
||||||
from bootstrapvz.common.tasks import image
|
from bootstrapvz.common.tasks import image, loopback, ssh, volume
|
||||||
from bootstrapvz.common.tasks import loopback
|
|
||||||
from bootstrapvz.common.tasks import ssh
|
|
||||||
from bootstrapvz.common.tasks import volume
|
|
||||||
import tasks.api
|
import tasks.api
|
||||||
import tasks.image
|
import tasks.image
|
||||||
import tasks.network
|
import tasks.network
|
||||||
|
@ -10,8 +7,8 @@ import tasks.packages
|
||||||
|
|
||||||
|
|
||||||
def validate_manifest(data, validator, error):
|
def validate_manifest(data, validator, error):
|
||||||
import os.path
|
from bootstrapvz.common.tools import rel_path
|
||||||
validator(data, os.path.join(os.path.dirname(__file__), 'manifest-schema.yml'))
|
validator(data, rel_path(__file__, 'manifest-schema.yml'))
|
||||||
|
|
||||||
keys = ['username', 'password', 'identity-domain']
|
keys = ['username', 'password', 'identity-domain']
|
||||||
if 'credentials' in data['provider']:
|
if 'credentials' in data['provider']:
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
from bootstrapvz.base import Task
|
from bootstrapvz.base import Task
|
||||||
from bootstrapvz.common import phases
|
from bootstrapvz.common import phases
|
||||||
from bootstrapvz.common.tools import config_get
|
from bootstrapvz.common.tools import config_get, rel_path
|
||||||
import os.path
|
|
||||||
|
|
||||||
|
|
||||||
class DefaultPackages(Task):
|
class DefaultPackages(Task):
|
||||||
|
@ -10,7 +9,7 @@ class DefaultPackages(Task):
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def run(cls, info):
|
def run(cls, info):
|
||||||
kernel_packages_path = os.path.join(os.path.dirname(__file__), 'packages-kernels.yml')
|
kernel_packages_path = rel_path(__file__, 'packages-kernels.yml')
|
||||||
kernel_package = config_get(kernel_packages_path, [info.manifest.release.codename,
|
kernel_package = config_get(kernel_packages_path, [info.manifest.release.codename,
|
||||||
info.manifest.system['architecture']])
|
info.manifest.system['architecture']])
|
||||||
info.packages.add(kernel_package)
|
info.packages.add(kernel_package)
|
||||||
|
|
|
@ -6,9 +6,8 @@ from bootstrapvz.common.tasks import loopback
|
||||||
|
|
||||||
|
|
||||||
def validate_manifest(data, validator, error):
|
def validate_manifest(data, validator, error):
|
||||||
import os.path
|
from bootstrapvz.common.tools import rel_path
|
||||||
schema_path = os.path.normpath(os.path.join(os.path.dirname(__file__), 'manifest-schema.yml'))
|
validator(data, rel_path(__file__, 'manifest-schema.yml'))
|
||||||
validator(data, schema_path)
|
|
||||||
|
|
||||||
|
|
||||||
def resolve_tasks(taskset, manifest):
|
def resolve_tasks(taskset, manifest):
|
||||||
|
|
|
@ -2,9 +2,10 @@ from bootstrapvz.base import Task
|
||||||
from bootstrapvz.common import phases
|
from bootstrapvz.common import phases
|
||||||
from bootstrapvz.common.tasks.packages import InstallPackages
|
from bootstrapvz.common.tasks.packages import InstallPackages
|
||||||
from bootstrapvz.common.exceptions import TaskError
|
from bootstrapvz.common.exceptions import TaskError
|
||||||
|
from bootstrapvz.common.tools import rel_path
|
||||||
import os
|
import os
|
||||||
|
|
||||||
assets = os.path.normpath(os.path.join(os.path.dirname(__file__), '../assets'))
|
assets = rel_path(__file__, '../assets')
|
||||||
|
|
||||||
|
|
||||||
class CheckGuestAdditionsPath(Task):
|
class CheckGuestAdditionsPath(Task):
|
||||||
|
|
|
@ -8,9 +8,8 @@ class DefaultPackages(Task):
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def run(cls, info):
|
def run(cls, info):
|
||||||
import os.path
|
from bootstrapvz.common.tools import config_get, rel_path
|
||||||
kernel_packages_path = os.path.join(os.path.dirname(__file__), 'packages-kernels.yml')
|
kernel_packages_path = rel_path(__file__, 'packages-kernels.yml')
|
||||||
from bootstrapvz.common.tools import config_get
|
|
||||||
kernel_package = config_get(kernel_packages_path, [info.manifest.release.codename,
|
kernel_package = config_get(kernel_packages_path, [info.manifest.release.codename,
|
||||||
info.manifest.system['architecture']])
|
info.manifest.system['architecture']])
|
||||||
info.packages.add(kernel_package)
|
info.packages.add(kernel_package)
|
||||||
|
|
|
@ -2,9 +2,9 @@
|
||||||
|
|
||||||
def pick_build_server(build_servers, manifest, preferences={}):
|
def pick_build_server(build_servers, manifest, preferences={}):
|
||||||
# Validate the build servers list
|
# Validate the build servers list
|
||||||
from bootstrapvz.common.tools import load_data
|
from bootstrapvz.common.tools import load_data, rel_path
|
||||||
import os.path
|
|
||||||
schema = load_data(os.path.normpath(os.path.join(os.path.dirname(__file__), 'build-servers-schema.yml')))
|
schema = load_data(rel_path(__file__, 'build-servers-schema.yml'))
|
||||||
import jsonschema
|
import jsonschema
|
||||||
jsonschema.validate(build_servers, schema)
|
jsonschema.validate(build_servers, schema)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue