mirror of
https://github.com/kevingruesser/bootstrap-vz.git
synced 2025-08-22 18:00:35 +00:00
Merge pull request #341 from nbraud/rel_path
Use the rel_path utility function
This commit is contained in:
commit
e5c96195bb
49 changed files with 113 additions and 168 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 error: The function tha raises an error when the validation fails
|
||||
"""
|
||||
import os.path
|
||||
schema_path = os.path.normpath(os.path.join(os.path.dirname(__file__), 'manifest-schema.yml'))
|
||||
validator(data, schema_path)
|
||||
from bootstrapvz.common.tools import rel_path
|
||||
validator(data, rel_path(__file__, 'manifest-schema.yml'))
|
||||
|
||||
from bootstrapvz.common.releases import get_release
|
||||
from bootstrapvz.common.releases import squeeze
|
||||
from bootstrapvz.common.releases import get_release, squeeze
|
||||
release = get_release(data['system']['release'])
|
||||
|
||||
if release < squeeze:
|
||||
|
|
|
@ -3,7 +3,7 @@ to determine which tasks should be added to the tasklist, what arguments various
|
|||
invocations should have etc..
|
||||
"""
|
||||
from bootstrapvz.common.exceptions import ManifestError
|
||||
from bootstrapvz.common.tools import load_data
|
||||
from bootstrapvz.common.tools import load_data, rel_path
|
||||
import logging
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
@ -28,9 +28,7 @@ class Manifest(object):
|
|||
raise ManifestError('`path\' or `data\' must be provided')
|
||||
self.path = path
|
||||
|
||||
import os.path
|
||||
self.metaschema = load_data(os.path.normpath(os.path.join(os.path.dirname(__file__),
|
||||
'metaschema.json')))
|
||||
self.metaschema = load_data(rel_path(__file__, 'metaschema.json'))
|
||||
|
||||
self.load_data(data)
|
||||
self.load_modules()
|
||||
|
|
|
@ -128,22 +128,22 @@ def get_all_tasks(loaded_modules):
|
|||
import pkgutil
|
||||
import os.path
|
||||
import bootstrapvz
|
||||
bootstrapvz_root = os.path.dirname(bootstrapvz.__file__)
|
||||
module_paths = set([(os.path.join(bootstrapvz_root, 'common/tasks'), 'bootstrapvz.common.tasks.')])
|
||||
from bootstrapvz.common.tools import rel_path
|
||||
module_paths = set([(rel_path(bootstrapvz.__file__, 'common/tasks'), 'bootstrapvz.common.tasks.')])
|
||||
|
||||
for module in loaded_modules:
|
||||
module_path = os.path.dirname(module.__file__)
|
||||
module_prefix = module.__name__ + '.'
|
||||
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']):
|
||||
module_path = os.path.join(module_loader.path, module_name)
|
||||
# The prefix param seems to do nothing, so we prefix the module name ourselves
|
||||
module_prefix = 'bootstrapvz.providers.{}.'.format(module_name)
|
||||
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']):
|
||||
module_path = os.path.join(module_loader.path, 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
|
||||
def run(cls, info):
|
||||
network_config_path = os.path.join(os.path.dirname(__file__), 'network-configuration.yml')
|
||||
from ..tools import config_get
|
||||
from ..tools import config_get, rel_path
|
||||
network_config_path = rel_path(__file__, 'network-configuration.yml')
|
||||
if_config = config_get(network_config_path, [info.manifest.release.codename])
|
||||
|
||||
interfaces_path = os.path.join(info.root, 'etc/network/interfaces')
|
||||
|
|
|
@ -137,4 +137,4 @@ def copy_tree(from_path, to_path):
|
|||
|
||||
def rel_path(base, path):
|
||||
import os.path
|
||||
return os.path.join(os.path.dirname(base), path)
|
||||
return os.path.normpath(os.path.join(os.path.dirname(base), path))
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
def validate_manifest(data, validator, error):
|
||||
import os.path
|
||||
|
||||
schema_path = os.path.normpath(os.path.join(os.path.dirname(__file__), 'manifest-schema.yml'))
|
||||
validator(data, schema_path)
|
||||
from bootstrapvz.common.tools import rel_path
|
||||
validator(data, rel_path(__file__, 'manifest-schema.yml'))
|
||||
|
||||
|
||||
def resolve_tasks(taskset, manifest):
|
||||
|
|
|
@ -2,9 +2,8 @@ import tasks
|
|||
|
||||
|
||||
def validate_manifest(data, validator, error):
|
||||
import os.path
|
||||
schema_path = os.path.normpath(os.path.join(os.path.dirname(__file__), 'manifest-schema.yml'))
|
||||
validator(data, schema_path)
|
||||
from bootstrapvz.common.tools import rel_path
|
||||
validator(data, rel_path(__file__, 'manifest-schema.yml'))
|
||||
|
||||
|
||||
def resolve_tasks(taskset, manifest):
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
def validate_manifest(data, validator, error):
|
||||
import os.path
|
||||
schema_path = os.path.normpath(os.path.join(os.path.dirname(__file__), 'manifest-schema.yml'))
|
||||
validator(data, schema_path)
|
||||
from bootstrapvz.common.tools import rel_path
|
||||
validator(data, rel_path(__file__, 'manifest-schema.yml'))
|
||||
|
||||
|
||||
def resolve_tasks(taskset, manifest):
|
||||
|
|
|
@ -2,9 +2,8 @@ import tasks
|
|||
|
||||
|
||||
def validate_manifest(data, validator, error):
|
||||
import os.path
|
||||
schema_path = os.path.normpath(os.path.join(os.path.dirname(__file__), 'manifest-schema.yml'))
|
||||
validator(data, schema_path)
|
||||
from bootstrapvz.common.tools import rel_path
|
||||
validator(data, rel_path(__file__, 'manifest-schema.yml'))
|
||||
|
||||
|
||||
def resolve_tasks(taskset, manifest):
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
|
||||
|
||||
def validate_manifest(data, validator, error):
|
||||
import os.path
|
||||
schema_path = os.path.normpath(os.path.join(os.path.dirname(__file__), 'manifest-schema.yml'))
|
||||
validator(data, schema_path)
|
||||
from bootstrapvz.common.tools import rel_path
|
||||
validator(data, rel_path(__file__, 'manifest-schema.yml'))
|
||||
|
||||
|
||||
def resolve_tasks(taskset, manifest):
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
|
||||
|
||||
def validate_manifest(data, validator, error):
|
||||
import os.path
|
||||
schema_path = os.path.normpath(os.path.join(os.path.dirname(__file__), 'manifest-schema.yml'))
|
||||
validator(data, schema_path)
|
||||
from bootstrapvz.common.tools import rel_path
|
||||
validator(data, rel_path(__file__, 'manifest-schema.yml'))
|
||||
|
||||
|
||||
def resolve_tasks(taskset, manifest):
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
def validate_manifest(data, validator, error):
|
||||
from bootstrapvz.common.tools import log_check_call
|
||||
import os.path
|
||||
schema_path = os.path.join(os.path.dirname(__file__),
|
||||
'schema.yaml')
|
||||
validator(data, schema_path)
|
||||
from bootstrapvz.common.tools import log_check_call, rel_path
|
||||
validator(data, rel_path(__file__, 'manifest-schema.yml'))
|
||||
|
||||
log_check_call(['debconf-set-selections', '--checkonly'],
|
||||
stdin=data['plugins']['debconf'])
|
||||
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
import os.path
|
||||
from bootstrapvz.common.tools import rel_path
|
||||
import tasks
|
||||
from bootstrapvz.common.tasks import apt
|
||||
from bootstrapvz.common.releases import wheezy
|
||||
|
||||
|
||||
def validate_manifest(data, validator, error):
|
||||
schema_path = os.path.normpath(os.path.join(os.path.dirname(__file__), 'manifest-schema.yml'))
|
||||
validator(data, schema_path)
|
||||
validator(data, rel_path(__file__, 'manifest-schema.yml'))
|
||||
|
||||
from bootstrapvz.common.releases import get_release
|
||||
if get_release(data['system']['release']) == wheezy:
|
||||
# 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.tasks import grub
|
||||
from bootstrapvz.common.tasks import initd
|
||||
from bootstrapvz.common.tools import log_check_call
|
||||
from bootstrapvz.common.tools import sed_i
|
||||
from bootstrapvz.common.tools import log_check_call, sed_i, rel_path
|
||||
import os
|
||||
import os.path
|
||||
import shutil
|
||||
import subprocess
|
||||
import time
|
||||
|
||||
ASSETS_DIR = os.path.normpath(os.path.join(os.path.dirname(__file__), 'assets'))
|
||||
ASSETS_DIR = rel_path(__file__, 'assets')
|
||||
|
||||
|
||||
class AddDockerDeps(Task):
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
def validate_manifest(data, validator, error):
|
||||
import os.path
|
||||
schema_path = os.path.normpath(os.path.join(os.path.dirname(__file__), 'manifest-schema.yml'))
|
||||
validator(data, schema_path)
|
||||
from bootstrapvz.common.tools import rel_path
|
||||
validator(data, rel_path(__file__, 'manifest-schema.yml'))
|
||||
|
||||
|
||||
def resolve_tasks(taskset, manifest):
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
def validate_manifest(data, validator, error):
|
||||
import os.path
|
||||
schema_path = os.path.normpath(os.path.join(os.path.dirname(__file__), 'manifest-schema.yml'))
|
||||
validator(data, schema_path)
|
||||
from bootstrapvz.common.tools import rel_path
|
||||
validator(data, rel_path(__file__, 'manifest-schema.yml'))
|
||||
|
||||
|
||||
def resolve_tasks(taskset, manifest):
|
||||
|
|
|
@ -2,10 +2,9 @@ import tasks
|
|||
|
||||
|
||||
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, schema_path)
|
||||
validator(data, rel_path(__file__, 'manifest-schema.yml'))
|
||||
|
||||
|
||||
def resolve_tasks(taskset, manifest):
|
||||
|
|
|
@ -1,10 +1,9 @@
|
|||
import tasks
|
||||
import os.path
|
||||
from bootstrapvz.common.tools import rel_path
|
||||
|
||||
|
||||
def validate_manifest(data, validator, error):
|
||||
schema_path = os.path.normpath(os.path.join(os.path.dirname(__file__), 'manifest-schema.yml'))
|
||||
validator(data, schema_path)
|
||||
validator(data, rel_path(__file__, 'manifest-schema.yml'))
|
||||
|
||||
|
||||
def resolve_tasks(taskset, manifest):
|
||||
|
|
|
@ -6,9 +6,9 @@ from bootstrapvz.common.tasks import locale
|
|||
|
||||
|
||||
def validate_manifest(data, validator, error):
|
||||
import os.path
|
||||
schema_path = os.path.join(os.path.dirname(__file__), 'manifest-schema.yml')
|
||||
validator(data, schema_path)
|
||||
from bootstrapvz.common.tools import rel_path
|
||||
validator(data, rel_path(__file__, 'manifest-schema.yml'))
|
||||
|
||||
if data['plugins']['minimize_size'].get('shrink', False) and data['volume']['backing'] != 'vmdk':
|
||||
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):
|
||||
import os.path
|
||||
schema_path = os.path.normpath(os.path.join(os.path.dirname(__file__), 'manifest-schema.yml'))
|
||||
validator(data, schema_path)
|
||||
from bootstrapvz.common.tools import rel_path
|
||||
validator(data, rel_path(__file__, 'manifest-schema.yml'))
|
||||
|
||||
|
||||
def resolve_tasks(taskset, manifest):
|
||||
|
|
|
@ -2,9 +2,8 @@ import tasks
|
|||
|
||||
|
||||
def validate_manifest(data, validator, error):
|
||||
import os.path
|
||||
schema_path = os.path.normpath(os.path.join(os.path.dirname(__file__), 'manifest-schema.yml'))
|
||||
validator(data, schema_path)
|
||||
from bootstrapvz.common.tools import rel_path
|
||||
validator(data, rel_path(__file__, 'manifest-schema.yml'))
|
||||
|
||||
|
||||
def resolve_tasks(taskset, manifest):
|
||||
|
|
|
@ -13,9 +13,8 @@ from bootstrapvz.common.tasks import partitioning
|
|||
|
||||
|
||||
def validate_manifest(data, validator, error):
|
||||
import os.path
|
||||
schema_path = os.path.normpath(os.path.join(os.path.dirname(__file__), 'manifest-schema.yml'))
|
||||
validator(data, schema_path)
|
||||
from bootstrapvz.common.tools import rel_path
|
||||
validator(data, rel_path(__file__, 'manifest-schema.yml'))
|
||||
|
||||
|
||||
def resolve_tasks(taskset, manifest):
|
||||
|
|
|
@ -2,9 +2,8 @@ import tasks
|
|||
|
||||
|
||||
def validate_manifest(data, validator, error):
|
||||
import os.path
|
||||
schema_path = os.path.normpath(os.path.join(os.path.dirname(__file__), 'manifest-schema.yml'))
|
||||
validator(data, schema_path)
|
||||
from bootstrapvz.common.tools import rel_path
|
||||
validator(data, rel_path(__file__, 'manifest-schema.yml'))
|
||||
|
||||
|
||||
def resolve_tasks(taskset, manifest):
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
|
||||
|
||||
def validate_manifest(data, validator, error):
|
||||
import os.path
|
||||
schema_path = os.path.normpath(os.path.join(os.path.dirname(__file__), 'manifest-schema.yml'))
|
||||
validator(data, schema_path)
|
||||
from bootstrapvz.common.tools import rel_path
|
||||
validator(data, rel_path(__file__, 'manifest-schema.yml'))
|
||||
|
||||
|
||||
def resolve_tasks(taskset, manifest):
|
||||
|
|
|
@ -2,9 +2,8 @@ import tasks
|
|||
|
||||
|
||||
def validate_manifest(data, validator, error):
|
||||
import os.path
|
||||
schema_path = os.path.normpath(os.path.join(os.path.dirname(__file__), 'manifest-schema.yml'))
|
||||
validator(data, schema_path)
|
||||
from bootstrapvz.common.tools import rel_path
|
||||
validator(data, rel_path(__file__, 'manifest-schema.yml'))
|
||||
|
||||
|
||||
def resolve_tasks(taskset, manifest):
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
|
||||
|
||||
def validate_manifest(data, validator, error):
|
||||
import os.path
|
||||
schema_path = os.path.normpath(os.path.join(os.path.dirname(__file__), 'manifest-schema.yml'))
|
||||
validator(data, schema_path)
|
||||
from bootstrapvz.common.tools import rel_path
|
||||
validator(data, rel_path(__file__, 'manifest-schema.yml'))
|
||||
|
||||
|
||||
def resolve_tasks(taskset, manifest):
|
||||
|
|
|
@ -1,14 +1,11 @@
|
|||
import tasks
|
||||
from bootstrapvz.common import task_groups
|
||||
from bootstrapvz.common.tasks import image
|
||||
from bootstrapvz.common.tasks import ssh
|
||||
from bootstrapvz.common.tasks import volume
|
||||
import os
|
||||
from bootstrapvz.common.tasks import image, ssh, volume
|
||||
from bootstrapvz.common.tools import rel_path
|
||||
|
||||
|
||||
def validate_manifest(data, validator, error):
|
||||
schema_path = os.path.normpath(os.path.join(os.path.dirname(__file__), 'manifest-schema.yml'))
|
||||
validator(data, schema_path)
|
||||
validator(data, rel_path(__file__, 'manifest-schema.yml'))
|
||||
|
||||
|
||||
def resolve_tasks(taskset, manifest):
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
from bootstrapvz.base import Task
|
||||
from bootstrapvz.common import phases
|
||||
from bootstrapvz.common.tasks import workspace
|
||||
from bootstrapvz.common.tools import rel_path
|
||||
import os
|
||||
import shutil
|
||||
|
||||
assets = os.path.normpath(os.path.join(os.path.dirname(__file__), 'assets'))
|
||||
assets = rel_path(__file__, 'assets')
|
||||
|
||||
|
||||
class CheckBoxPath(Task):
|
||||
|
|
|
@ -10,9 +10,8 @@ from bootstrapvz.common.tasks import grub
|
|||
|
||||
|
||||
def validate_manifest(data, validator, error):
|
||||
import os.path
|
||||
schema_path = os.path.normpath(os.path.join(os.path.dirname(__file__), 'manifest-schema.yml'))
|
||||
validator(data, schema_path)
|
||||
from bootstrapvz.common.tools import rel_path
|
||||
validator(data, rel_path(__file__, 'manifest-schema.yml'))
|
||||
|
||||
|
||||
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('parted')
|
||||
|
||||
import os.path
|
||||
kernel_packages_path = os.path.join(os.path.dirname(__file__), 'packages-kernels.yml')
|
||||
from bootstrapvz.common.tools import config_get
|
||||
from bootstrapvz.common.tools import config_get, rel_path
|
||||
kernel_packages_path = rel_path(__file__, 'packages-kernels.yml')
|
||||
kernel_package = config_get(kernel_packages_path, [info.manifest.release.codename,
|
||||
info.manifest.system['architecture']])
|
||||
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.tasks import apt, folder, filesystem
|
||||
from bootstrapvz.common.tools import rel_path
|
||||
import tasks.commands
|
||||
import tasks.image
|
||||
|
||||
|
||||
def validate_manifest(data, validator, error):
|
||||
import os.path
|
||||
schema_path = os.path.normpath(os.path.join(os.path.dirname(__file__), 'manifest-schema.yml'))
|
||||
schema_path = rel_path(__file__, 'manifest-schema.yml')
|
||||
validator(data, schema_path)
|
||||
|
||||
|
||||
|
|
|
@ -9,19 +9,13 @@ import tasks.boot
|
|||
import tasks.network
|
||||
import tasks.initd
|
||||
import tasks.tuning
|
||||
from bootstrapvz.common.tasks import volume
|
||||
from bootstrapvz.common.tasks import filesystem
|
||||
from bootstrapvz.common.tasks import boot
|
||||
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
|
||||
from bootstrapvz.common.tasks import apt, boot, filesystem, grub, initd
|
||||
from bootstrapvz.common.tasks import kernel, loopback, volume
|
||||
from bootstrapvz.common.tools import rel_path
|
||||
|
||||
|
||||
def validate_manifest(data, validator, error):
|
||||
import os.path
|
||||
validator(data, os.path.join(os.path.dirname(__file__), 'manifest-schema.yml'))
|
||||
validator(data, rel_path(__file__, 'manifest-schema.yml'))
|
||||
|
||||
from bootstrapvz.common.bytes import Bytes
|
||||
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')
|
||||
error(msg, ['volume', 'partitions'])
|
||||
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']
|
||||
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.common import phases
|
||||
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 bootstrapvz.common.tasks import workspace
|
||||
import connection
|
||||
|
@ -116,7 +116,7 @@ class RegisterAMI(Task):
|
|||
registration_params['virtualization_type'] = 'hvm'
|
||||
else:
|
||||
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
|
||||
registration_params['kernel_id'] = config_get(akis_path, [info._ec2['region'],
|
||||
info.manifest.system['architecture']])
|
||||
|
|
|
@ -9,9 +9,10 @@ class DefaultPackages(Task):
|
|||
|
||||
@classmethod
|
||||
def run(cls, info):
|
||||
from bootstrapvz.common.tools import rel_path
|
||||
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
|
||||
kernel_package = config_get(kernel_packages_path, [info.manifest.release.codename,
|
||||
info.manifest.system['architecture']])
|
||||
|
|
|
@ -6,20 +6,13 @@ import tasks.image
|
|||
import tasks.initd
|
||||
import tasks.host
|
||||
import tasks.packages
|
||||
from bootstrapvz.common.tasks import apt
|
||||
from bootstrapvz.common.tasks import boot
|
||||
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
|
||||
from bootstrapvz.common.tasks import apt, boot, image, loopback, initd
|
||||
from bootstrapvz.common.tasks import ssh, volume, grub
|
||||
|
||||
|
||||
def validate_manifest(data, validator, error):
|
||||
import os.path
|
||||
schema_path = os.path.normpath(os.path.join(os.path.dirname(__file__), 'manifest-schema.yml'))
|
||||
validator(data, schema_path)
|
||||
from bootstrapvz.common.tools import rel_path
|
||||
validator(data, rel_path(__file__, 'manifest-schema.yml'))
|
||||
|
||||
|
||||
def resolve_tasks(taskset, manifest):
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
from bootstrapvz.base import Task
|
||||
from bootstrapvz.common import phases
|
||||
from bootstrapvz.common.tasks import packages
|
||||
from bootstrapvz.common.tools import config_get
|
||||
import os
|
||||
from bootstrapvz.common.tools import config_get, rel_path
|
||||
|
||||
|
||||
class DefaultPackages(Task):
|
||||
|
@ -29,7 +28,7 @@ class DefaultPackages(Task):
|
|||
info.packages.add('sudo')
|
||||
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,
|
||||
info.manifest.system['architecture']])
|
||||
info.packages.add(kernel_package)
|
||||
|
|
|
@ -1,15 +1,11 @@
|
|||
from bootstrapvz.common import task_groups
|
||||
import tasks.packages
|
||||
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 image, loopback, initd, ssh
|
||||
|
||||
|
||||
def validate_manifest(data, validator, error):
|
||||
import os.path
|
||||
schema_path = os.path.normpath(os.path.join(os.path.dirname(__file__), 'manifest-schema.yml'))
|
||||
validator(data, schema_path)
|
||||
from bootstrapvz.common.tools import rel_path
|
||||
validator(data, rel_path(__file__, 'manifest-schema.yml'))
|
||||
|
||||
|
||||
def resolve_tasks(taskset, manifest):
|
||||
|
|
|
@ -8,9 +8,8 @@ class DefaultPackages(Task):
|
|||
|
||||
@classmethod
|
||||
def run(cls, info):
|
||||
import os.path
|
||||
kernel_packages_path = os.path.join(os.path.dirname(__file__), 'packages-kernels.yml')
|
||||
from bootstrapvz.common.tools import config_get
|
||||
from bootstrapvz.common.tools import config_get, rel_path
|
||||
kernel_packages_path = rel_path(__file__, 'packages-kernels.yml')
|
||||
kernel_package = config_get(kernel_packages_path, [info.manifest.release.codename,
|
||||
info.manifest.system['architecture']])
|
||||
info.packages.add(kernel_package)
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
from bootstrapvz.common import task_groups
|
||||
from bootstrapvz.common.tasks import image
|
||||
from bootstrapvz.common.tasks import loopback
|
||||
from bootstrapvz.common.tasks import ssh
|
||||
from bootstrapvz.common.tasks import volume
|
||||
from bootstrapvz.common.tasks import image, loopback, ssh, volume
|
||||
import tasks.api
|
||||
import tasks.image
|
||||
import tasks.network
|
||||
|
@ -10,8 +7,8 @@ import tasks.packages
|
|||
|
||||
|
||||
def validate_manifest(data, validator, error):
|
||||
import os.path
|
||||
validator(data, os.path.join(os.path.dirname(__file__), 'manifest-schema.yml'))
|
||||
from bootstrapvz.common.tools import rel_path
|
||||
validator(data, rel_path(__file__, 'manifest-schema.yml'))
|
||||
|
||||
keys = ['username', 'password', 'identity-domain']
|
||||
if 'credentials' in data['provider']:
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
from bootstrapvz.base import Task
|
||||
from bootstrapvz.common import phases
|
||||
from bootstrapvz.common.tools import config_get
|
||||
import os.path
|
||||
from bootstrapvz.common.tools import config_get, rel_path
|
||||
|
||||
|
||||
class DefaultPackages(Task):
|
||||
|
@ -10,7 +9,7 @@ class DefaultPackages(Task):
|
|||
|
||||
@classmethod
|
||||
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,
|
||||
info.manifest.system['architecture']])
|
||||
info.packages.add(kernel_package)
|
||||
|
|
|
@ -6,9 +6,8 @@ from bootstrapvz.common.tasks import loopback
|
|||
|
||||
|
||||
def validate_manifest(data, validator, error):
|
||||
import os.path
|
||||
schema_path = os.path.normpath(os.path.join(os.path.dirname(__file__), 'manifest-schema.yml'))
|
||||
validator(data, schema_path)
|
||||
from bootstrapvz.common.tools import rel_path
|
||||
validator(data, rel_path(__file__, 'manifest-schema.yml'))
|
||||
|
||||
|
||||
def resolve_tasks(taskset, manifest):
|
||||
|
|
|
@ -2,9 +2,10 @@ from bootstrapvz.base import Task
|
|||
from bootstrapvz.common import phases
|
||||
from bootstrapvz.common.tasks.packages import InstallPackages
|
||||
from bootstrapvz.common.exceptions import TaskError
|
||||
from bootstrapvz.common.tools import rel_path
|
||||
import os
|
||||
|
||||
assets = os.path.normpath(os.path.join(os.path.dirname(__file__), '../assets'))
|
||||
assets = rel_path(__file__, '../assets')
|
||||
|
||||
|
||||
class CheckGuestAdditionsPath(Task):
|
||||
|
|
|
@ -8,9 +8,8 @@ class DefaultPackages(Task):
|
|||
|
||||
@classmethod
|
||||
def run(cls, info):
|
||||
import os.path
|
||||
kernel_packages_path = os.path.join(os.path.dirname(__file__), 'packages-kernels.yml')
|
||||
from bootstrapvz.common.tools import config_get
|
||||
from bootstrapvz.common.tools import config_get, rel_path
|
||||
kernel_packages_path = rel_path(__file__, 'packages-kernels.yml')
|
||||
kernel_package = config_get(kernel_packages_path, [info.manifest.release.codename,
|
||||
info.manifest.system['architecture']])
|
||||
info.packages.add(kernel_package)
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
|
||||
def pick_build_server(build_servers, manifest, preferences={}):
|
||||
# Validate the build servers list
|
||||
from bootstrapvz.common.tools import load_data
|
||||
import os.path
|
||||
schema = load_data(os.path.normpath(os.path.join(os.path.dirname(__file__), 'build-servers-schema.yml')))
|
||||
from bootstrapvz.common.tools import load_data, rel_path
|
||||
|
||||
schema = load_data(rel_path(__file__, 'build-servers-schema.yml'))
|
||||
import jsonschema
|
||||
jsonschema.validate(build_servers, schema)
|
||||
|
||||
|
|
|
@ -66,9 +66,8 @@ Typically it looks like this:
|
|||
.. code-block:: python
|
||||
|
||||
def validate_manifest(data, validator, error):
|
||||
import os.path
|
||||
schema_path = os.path.normpath(os.path.join(os.path.dirname(__file__), 'manifest-schema.yml'))
|
||||
validator(data, schema_path)
|
||||
from bootstrapvz.common.tools import rel_path
|
||||
validator(data, rel_path(__file__, 'manifest-schema.yml'))
|
||||
|
||||
This code validates the manifest against a schema in your plugin folder.
|
||||
The schema is a `JSON schema <http://json-schema.org/>`__, since bootstrap-vz
|
||||
|
|
Loading…
Add table
Reference in a new issue