From bbb06d717eb85661800d663ff9db498a9fb80dbf Mon Sep 17 00:00:00 2001 From: Anders Ingemann Date: Sun, 23 Mar 2014 23:12:07 +0100 Subject: [PATCH] Properly fix imports and make bootstrapvz work like a package --- bootstrap-vz | 5 +++ bootstrapvz/__init__.py | 5 --- bootstrapvz/base/bootstrapinfo.py | 2 +- bootstrapvz/base/fs/__init__.py | 8 ++-- bootstrapvz/base/fs/partitionmaps/abstract.py | 4 +- bootstrapvz/base/fs/partitionmaps/gpt.py | 4 +- bootstrapvz/base/fs/partitionmaps/msdos.py | 4 +- bootstrapvz/base/fs/partitionmaps/none.py | 2 +- bootstrapvz/base/fs/partitions/abstract.py | 4 +- bootstrapvz/base/fs/partitions/base.py | 2 +- bootstrapvz/base/fs/partitions/gpt.py | 2 +- bootstrapvz/base/fs/partitions/gpt_swap.py | 2 +- bootstrapvz/base/fs/partitions/msdos_swap.py | 2 +- bootstrapvz/base/fs/partitions/single.py | 2 +- bootstrapvz/base/fs/volume.py | 6 +-- bootstrapvz/base/manifest.py | 6 +-- bootstrapvz/base/phase.py | 2 +- bootstrapvz/base/tasklist.py | 13 +++--- bootstrapvz/bootstrap-vz | 6 --- bootstrapvz/common/fs/loopbackvolume.py | 4 +- bootstrapvz/common/fs/qemuvolume.py | 10 ++--- bootstrapvz/common/fs/virtualdiskimage.py | 2 +- bootstrapvz/common/fs/virtualmachinedisk.py | 2 +- bootstrapvz/common/phases.py | 2 +- bootstrapvz/common/task_sets.py | 24 +++++----- bootstrapvz/common/tasks/apt.py | 6 +-- bootstrapvz/common/tasks/boot.py | 20 ++++----- bootstrapvz/common/tasks/bootstrap.py | 10 ++--- bootstrapvz/common/tasks/cleanup.py | 6 +-- bootstrapvz/common/tasks/development.py | 6 +-- bootstrapvz/common/tasks/filesystem.py | 10 ++--- bootstrapvz/common/tasks/host.py | 8 ++-- bootstrapvz/common/tasks/initd.py | 10 ++--- bootstrapvz/common/tasks/locale.py | 8 ++-- bootstrapvz/common/tasks/loopback.py | 8 ++-- bootstrapvz/common/tasks/network.py | 6 +-- bootstrapvz/common/tasks/packages.py | 10 ++--- bootstrapvz/common/tasks/partitioning.py | 6 +-- bootstrapvz/common/tasks/security.py | 8 ++-- bootstrapvz/common/tasks/volume.py | 6 +-- bootstrapvz/common/tasks/workspace.py | 4 +- bootstrapvz/plugins/admin_user/__init__.py | 2 +- bootstrapvz/plugins/admin_user/tasks.py | 16 +++---- bootstrapvz/plugins/build_metadata/tasks.py | 4 +- bootstrapvz/plugins/cloud_init/__init__.py | 4 +- bootstrapvz/plugins/cloud_init/tasks.py | 10 ++--- bootstrapvz/plugins/image_commands/tasks.py | 6 +-- bootstrapvz/plugins/minimize_size/tasks.py | 20 ++++----- bootstrapvz/plugins/opennebula/tasks.py | 6 +-- .../plugins/prebootstrapped/__init__.py | 18 ++++---- bootstrapvz/plugins/prebootstrapped/tasks.py | 16 +++---- bootstrapvz/plugins/puppet/tasks.py | 16 +++---- bootstrapvz/plugins/root_password/__init__.py | 2 +- bootstrapvz/plugins/root_password/tasks.py | 6 +-- .../plugins/unattended_upgrades/tasks.py | 6 +-- bootstrapvz/plugins/vagrant/__init__.py | 8 ++-- bootstrapvz/plugins/vagrant/tasks.py | 22 +++++----- bootstrapvz/providers/ec2/__init__.py | 44 +++++++++---------- bootstrapvz/providers/ec2/ebsvolume.py | 4 +- bootstrapvz/providers/ec2/tasks/ami.py | 12 ++--- bootstrapvz/providers/ec2/tasks/boot.py | 14 +++--- bootstrapvz/providers/ec2/tasks/connection.py | 4 +- bootstrapvz/providers/ec2/tasks/ebs.py | 4 +- bootstrapvz/providers/ec2/tasks/filesystem.py | 4 +- bootstrapvz/providers/ec2/tasks/host.py | 6 +-- bootstrapvz/providers/ec2/tasks/initd.py | 6 +-- bootstrapvz/providers/ec2/tasks/network.py | 10 ++--- bootstrapvz/providers/ec2/tasks/packages.py | 8 ++-- bootstrapvz/providers/kvm/__init__.py | 40 ++++++++--------- bootstrapvz/providers/kvm/tasks/packages.py | 6 +-- bootstrapvz/providers/kvm/tasks/virtio.py | 4 +- bootstrapvz/providers/virtualbox/__init__.py | 40 ++++++++--------- .../virtualbox/tasks/guest_additions.py | 12 ++--- .../providers/virtualbox/tasks/packages.py | 6 +-- 74 files changed, 320 insertions(+), 323 deletions(-) create mode 100755 bootstrap-vz delete mode 100755 bootstrapvz/bootstrap-vz diff --git a/bootstrap-vz b/bootstrap-vz new file mode 100755 index 0000000..46f8fbf --- /dev/null +++ b/bootstrap-vz @@ -0,0 +1,5 @@ +#!/usr/bin/env python + +if __name__ == '__main__': + from bootstrapvz.base import main + main() diff --git a/bootstrapvz/__init__.py b/bootstrapvz/__init__.py index 5e8d487..c3ba8db 100644 --- a/bootstrapvz/__init__.py +++ b/bootstrapvz/__init__.py @@ -1,8 +1,3 @@ __version__ = '0.9' - - -if __name__ == '__main__': - from base import main - sys.exit(main()) diff --git a/bootstrapvz/base/bootstrapinfo.py b/bootstrapvz/base/bootstrapinfo.py index 06d529b..a14e7ff 100644 --- a/bootstrapvz/base/bootstrapinfo.py +++ b/bootstrapvz/base/bootstrapinfo.py @@ -35,7 +35,7 @@ class BootstrapInformation(object): # Normalize the release codenames so that tasks may query for release codenames rather than # 'stable', 'unstable' etc. This is useful when handling cases that are specific to a release. release_codenames_path = os.path.join(os.path.dirname(__file__), 'release-codenames.json') - from common.tools import config_get + from bootstrapvz.common.tools import config_get self.release_codename = config_get(release_codenames_path, [self.manifest.system['release']]) class DictClass(dict): diff --git a/bootstrapvz/base/fs/__init__.py b/bootstrapvz/base/fs/__init__.py index 8473757..b575b87 100644 --- a/bootstrapvz/base/fs/__init__.py +++ b/bootstrapvz/base/fs/__init__.py @@ -9,10 +9,10 @@ def load_volume(data, bootloader): Returns: Volume. The volume that represents all information pertaining to the volume we bootstrap on """ - from ...common.fs.loopbackvolume import LoopbackVolume - from ...providers.ec2.ebsvolume import EBSVolume - from ...common.fs.virtualdiskimage import VirtualDiskImage - from ...common.fs.virtualmachinedisk import VirtualMachineDisk + from bootstrapvz.common.fs.loopbackvolume import LoopbackVolume + from bootstrapvz.providers.ec2.ebsvolume import EBSVolume + from bootstrapvz.common.fs.virtualdiskimage import VirtualDiskImage + from bootstrapvz.common.fs.virtualmachinedisk import VirtualMachineDisk # Create a mapping between valid partition maps in the manifest and their corresponding classes from partitionmaps.gpt import GPTPartitionMap from partitionmaps.msdos import MSDOSPartitionMap diff --git a/bootstrapvz/base/fs/partitionmaps/abstract.py b/bootstrapvz/base/fs/partitionmaps/abstract.py index 98e6f2a..0d7824d 100644 --- a/bootstrapvz/base/fs/partitionmaps/abstract.py +++ b/bootstrapvz/base/fs/partitionmaps/abstract.py @@ -1,7 +1,7 @@ from abc import ABCMeta from abc import abstractmethod -from ....common.tools import log_check_call -from ....common.fsm_proxy import FSMProxy +from bootstrapvz.common.tools import log_check_call +from bootstrapvz.common.fsm_proxy import FSMProxy from ..exceptions import PartitionError diff --git a/bootstrapvz/base/fs/partitionmaps/gpt.py b/bootstrapvz/base/fs/partitionmaps/gpt.py index 70bf010..9edfcad 100644 --- a/bootstrapvz/base/fs/partitionmaps/gpt.py +++ b/bootstrapvz/base/fs/partitionmaps/gpt.py @@ -1,7 +1,7 @@ from abstract import AbstractPartitionMap from ..partitions.gpt import GPTPartition from ..partitions.gpt_swap import GPTSwapPartition -from ....common.tools import log_check_call +from bootstrapvz.common.tools import log_check_call class GPTPartitionMap(AbstractPartitionMap): @@ -14,7 +14,7 @@ class GPTPartitionMap(AbstractPartitionMap): data (dict): volume.partitions part of the manifest bootloader (str): Name of the bootloader we will use for bootstrapping """ - from ....common.bytes import Bytes + from bootstrapvz.common.bytes import Bytes # List of partitions self.partitions = [] diff --git a/bootstrapvz/base/fs/partitionmaps/msdos.py b/bootstrapvz/base/fs/partitionmaps/msdos.py index 817ec30..d21ec64 100644 --- a/bootstrapvz/base/fs/partitionmaps/msdos.py +++ b/bootstrapvz/base/fs/partitionmaps/msdos.py @@ -1,7 +1,7 @@ from abstract import AbstractPartitionMap from ..partitions.msdos import MSDOSPartition from ..partitions.msdos_swap import MSDOSSwapPartition -from ....common.tools import log_check_call +from bootstrapvz.common.tools import log_check_call class MSDOSPartitionMap(AbstractPartitionMap): @@ -15,7 +15,7 @@ class MSDOSPartitionMap(AbstractPartitionMap): data (dict): volume.partitions part of the manifest bootloader (str): Name of the bootloader we will use for bootstrapping """ - from ....common.bytes import Bytes + from bootstrapvz.common.bytes import Bytes # List of partitions self.partitions = [] diff --git a/bootstrapvz/base/fs/partitionmaps/none.py b/bootstrapvz/base/fs/partitionmaps/none.py index 9dca5c7..734626f 100644 --- a/bootstrapvz/base/fs/partitionmaps/none.py +++ b/bootstrapvz/base/fs/partitionmaps/none.py @@ -13,7 +13,7 @@ class NoPartitions(object): data (dict): volume.partitions part of the manifest bootloader (str): Name of the bootloader we will use for bootstrapping """ - from ....common.bytes import Bytes + from bootstrapvz.common.bytes import Bytes # In the NoPartitions partitions map we only have a single 'partition' self.root = SinglePartition(Bytes(data['root']['size']), data['root']['filesystem'], data['root'].get('format_command', None)) diff --git a/bootstrapvz/base/fs/partitions/abstract.py b/bootstrapvz/base/fs/partitions/abstract.py index e9f4dca..0384916 100644 --- a/bootstrapvz/base/fs/partitions/abstract.py +++ b/bootstrapvz/base/fs/partitions/abstract.py @@ -1,8 +1,8 @@ from abc import ABCMeta from abc import abstractmethod import os.path -from ....common.tools import log_check_call -from ....common.fsm_proxy import FSMProxy +from bootstrapvz.common.tools import log_check_call +from bootstrapvz.common.fsm_proxy import FSMProxy class AbstractPartition(FSMProxy): diff --git a/bootstrapvz/base/fs/partitions/base.py b/bootstrapvz/base/fs/partitions/base.py index 0ab8a8f..c1ac273 100644 --- a/bootstrapvz/base/fs/partitions/base.py +++ b/bootstrapvz/base/fs/partitions/base.py @@ -29,7 +29,7 @@ class BasePartition(AbstractPartition): # By saving the previous partition we have # a linked list that partitions can go backwards in to find the first partition. self.previous = previous - from common.bytes import Bytes + from bootstrapvz.common.bytes import Bytes # Initialize the offset to 0 bytes, may be changed later self.offset = Bytes(0) # List of flags that parted should put on the partition diff --git a/bootstrapvz/base/fs/partitions/gpt.py b/bootstrapvz/base/fs/partitions/gpt.py index 5f3efc0..79dd30c 100644 --- a/bootstrapvz/base/fs/partitions/gpt.py +++ b/bootstrapvz/base/fs/partitions/gpt.py @@ -1,4 +1,4 @@ -from ....common.tools import log_check_call +from bootstrapvz.common.tools import log_check_call from base import BasePartition diff --git a/bootstrapvz/base/fs/partitions/gpt_swap.py b/bootstrapvz/base/fs/partitions/gpt_swap.py index 448e260..6dc5865 100644 --- a/bootstrapvz/base/fs/partitions/gpt_swap.py +++ b/bootstrapvz/base/fs/partitions/gpt_swap.py @@ -1,4 +1,4 @@ -from ....common.tools import log_check_call +from bootstrapvz.common.tools import log_check_call from gpt import GPTPartition diff --git a/bootstrapvz/base/fs/partitions/msdos_swap.py b/bootstrapvz/base/fs/partitions/msdos_swap.py index 3321220..12085e0 100644 --- a/bootstrapvz/base/fs/partitions/msdos_swap.py +++ b/bootstrapvz/base/fs/partitions/msdos_swap.py @@ -1,4 +1,4 @@ -from ....common.tools import log_check_call +from bootstrapvz.common.tools import log_check_call from msdos import MSDOSPartition diff --git a/bootstrapvz/base/fs/partitions/single.py b/bootstrapvz/base/fs/partitions/single.py index 632db60..297041e 100644 --- a/bootstrapvz/base/fs/partitions/single.py +++ b/bootstrapvz/base/fs/partitions/single.py @@ -11,6 +11,6 @@ class SinglePartition(AbstractPartition): Returns: Bytes. The starting byte of this partition """ - from ....common.bytes import Bytes + from bootstrapvz.common.bytes import Bytes # On an unpartitioned volume there is no offset and no previous partition return Bytes(0) diff --git a/bootstrapvz/base/fs/volume.py b/bootstrapvz/base/fs/volume.py index 68c4672..50bf213 100644 --- a/bootstrapvz/base/fs/volume.py +++ b/bootstrapvz/base/fs/volume.py @@ -1,6 +1,6 @@ from abc import ABCMeta -from ...common.fsm_proxy import FSMProxy -from ...common.tools import log_check_call +from bootstrapvz.common.fsm_proxy import FSMProxy +from bootstrapvz.common.tools import log_check_call from .exceptions import VolumeError from partitionmaps.none import NoPartitions @@ -90,7 +90,7 @@ class Volume(FSMProxy): VolumeError """ import os.path - from ...common.fs import get_partitions + from bootstrapvz.common.fs import get_partitions # Fetch information from /proc/partitions proc_partitions = get_partitions() device_name = os.path.basename(self.device_path) diff --git a/bootstrapvz/base/manifest.py b/bootstrapvz/base/manifest.py index ec8ae7e..631f6c1 100644 --- a/bootstrapvz/base/manifest.py +++ b/bootstrapvz/base/manifest.py @@ -3,7 +3,7 @@ to determine which tasks should be added to the tasklist, what arguments various invocations should have etc.. .. module:: manifest """ -from ..common.tools import load_json +from bootstrapvz.common.tools import load_json import logging log = logging.getLogger(__name__) @@ -36,7 +36,7 @@ class Manifest(object): # It strips comments (which are invalid in strict json) before loading the data. self.data = load_json(self.path) # Get the provider name from the manifest and load the corresponding module - provider_modname = 'providers.{provider}'.format(provider=self.data['provider']) + provider_modname = 'bootstrapvz.providers.{provider}'.format(provider=self.data['provider']) log.debug('Loading provider `{modname}\''.format(modname=provider_modname)) # Create a modules dict that contains the loaded provider and plugins self.modules = {'provider': __import__(provider_modname, fromlist=['providers']), @@ -45,7 +45,7 @@ class Manifest(object): # Run through all the plugins mentioned in the manifest and load them if 'plugins' in self.data: for plugin_name, plugin_data in self.data['plugins'].iteritems(): - modname = 'plugins.{plugin}'.format(plugin=plugin_name) + modname = 'bootstrapvz.plugins.{plugin}'.format(plugin=plugin_name) log.debug('Loading plugin `{modname}\''.format(modname=modname)) plugin = __import__(modname, fromlist=['plugins']) self.modules['plugins'].append(plugin) diff --git a/bootstrapvz/base/phase.py b/bootstrapvz/base/phase.py index b7d3935..3a5e320 100644 --- a/bootstrapvz/base/phase.py +++ b/bootstrapvz/base/phase.py @@ -18,7 +18,7 @@ class Phase(object): Returns: int. The positional index of the phase in relation to the other phases """ - from common.phases import order + from bootstrapvz.common.phases import order return next(i for i, phase in enumerate(order) if phase is self) def __cmp__(self, other): diff --git a/bootstrapvz/base/tasklist.py b/bootstrapvz/base/tasklist.py index 212ebb1..1016246 100644 --- a/bootstrapvz/base/tasklist.py +++ b/bootstrapvz/base/tasklist.py @@ -2,7 +2,7 @@ .. module:: tasklist """ -from ..common.exceptions import TaskListError +from bootstrapvz.common.exceptions import TaskListError import logging log = logging.getLogger(__name__) @@ -63,7 +63,7 @@ class TaskList(object): def create_list(self): """Creates a list of all the tasks that should be run. """ - from common.phases import order + from bootstrapvz.common.phases import order # Get a hold of all tasks tasks = self.get_all_tasks() # Make sure the taskset is a subset of all the tasks we have gathered @@ -113,7 +113,9 @@ class TaskList(object): list. A list of all tasks in the package """ # Get a generator that returns all classes in the package - classes = self.get_all_classes('..') + import os.path + pkg_path = os.path.normpath(os.path.join(os.path.dirname(__file__), '..')) + classes = self.get_all_classes(pkg_path, 'bootstrapvz.') # lambda function to check whether a class is a task (excluding the superclass Task) def is_task(obj): @@ -121,11 +123,12 @@ class TaskList(object): return issubclass(obj, Task) and obj is not Task return filter(is_task, classes) # Only return classes that are tasks - def get_all_classes(self, path=None): + def get_all_classes(self, path=None, prefix=''): """ Given a path to a package, this function retrieves all the classes in it Args: path (str): Path to the package + prefix (str): Name of the package followed by a dot Returns: generator. A generator that yields classes @@ -139,7 +142,7 @@ class TaskList(object): def walk_error(module): raise Exception('Unable to inspect module `{module}\''.format(module=module)) - walker = pkgutil.walk_packages(path, '', walk_error) + walker = pkgutil.walk_packages([path], prefix, walk_error) for _, module_name, _ in walker: module = importlib.import_module(module_name) classes = inspect.getmembers(module, inspect.isclass) diff --git a/bootstrapvz/bootstrap-vz b/bootstrapvz/bootstrap-vz deleted file mode 100755 index bffc990..0000000 --- a/bootstrapvz/bootstrap-vz +++ /dev/null @@ -1,6 +0,0 @@ -#!/usr/bin/env python - - -if __name__ == '__main__' and __package__ is None: - from base import main - main() diff --git a/bootstrapvz/common/fs/loopbackvolume.py b/bootstrapvz/common/fs/loopbackvolume.py index 87dfc1a..c0481b6 100644 --- a/bootstrapvz/common/fs/loopbackvolume.py +++ b/bootstrapvz/common/fs/loopbackvolume.py @@ -1,5 +1,5 @@ -from base.fs.volume import Volume -from common.tools import log_check_call +from bootstrapvz.base.fs.volume import Volume +from ..tools import log_check_call class LoopbackVolume(Volume): diff --git a/bootstrapvz/common/fs/qemuvolume.py b/bootstrapvz/common/fs/qemuvolume.py index 82091f8..c079532 100644 --- a/bootstrapvz/common/fs/qemuvolume.py +++ b/bootstrapvz/common/fs/qemuvolume.py @@ -1,7 +1,7 @@ -from common.fs.loopbackvolume import LoopbackVolume -from base.fs.exceptions import VolumeError -from common.tools import log_check_call -from common.fs import get_partitions +from loopbackvolume import LoopbackVolume +from bootstrapvz.base.fs.exceptions import VolumeError +from ..tools import log_check_call +from . import get_partitions class QEMUVolume(LoopbackVolume): @@ -12,7 +12,7 @@ class QEMUVolume(LoopbackVolume): log_check_call(['qemu-img', 'create', '-f', self.qemu_format, self.image_path, vol_size]) def _check_nbd_module(self): - from base.fs.partitionmaps.none import NoPartitions + from bootstrapvz.base.fs.partitionmaps.none import NoPartitions if isinstance(self.partition_map, NoPartitions): if not self._module_loaded('nbd'): msg = ('The kernel module `nbd\' must be loaded ' diff --git a/bootstrapvz/common/fs/virtualdiskimage.py b/bootstrapvz/common/fs/virtualdiskimage.py index 8d177d6..b36c8fc 100644 --- a/bootstrapvz/common/fs/virtualdiskimage.py +++ b/bootstrapvz/common/fs/virtualdiskimage.py @@ -1,4 +1,4 @@ -from common.fs.qemuvolume import QEMUVolume +from qemuvolume import QEMUVolume class VirtualDiskImage(QEMUVolume): diff --git a/bootstrapvz/common/fs/virtualmachinedisk.py b/bootstrapvz/common/fs/virtualmachinedisk.py index 6126aec..499c84a 100644 --- a/bootstrapvz/common/fs/virtualmachinedisk.py +++ b/bootstrapvz/common/fs/virtualmachinedisk.py @@ -1,4 +1,4 @@ -from common.fs.qemuvolume import QEMUVolume +from qemuvolume import QEMUVolume class VirtualMachineDisk(QEMUVolume): diff --git a/bootstrapvz/common/phases.py b/bootstrapvz/common/phases.py index d6cf8a1..e83feab 100644 --- a/bootstrapvz/common/phases.py +++ b/bootstrapvz/common/phases.py @@ -1,4 +1,4 @@ -from base import Phase +from bootstrapvz.base.phase import Phase preparation = Phase('Preparation', 'Initializing connections, fetching data etc.') volume_creation = Phase('Volume creation', 'Creating the volume to bootstrap onto') diff --git a/bootstrapvz/common/task_sets.py b/bootstrapvz/common/task_sets.py index a64e5c6..dbf09ef 100644 --- a/bootstrapvz/common/task_sets.py +++ b/bootstrapvz/common/task_sets.py @@ -1,15 +1,15 @@ -from common.tasks import workspace -from common.tasks import packages -from common.tasks import host -from common.tasks import boot -from common.tasks import bootstrap -from common.tasks import volume -from common.tasks import filesystem -from common.tasks import partitioning -from common.tasks import cleanup -from common.tasks import apt -from common.tasks import security -from common.tasks import locale +from tasks import workspace +from tasks import packages +from tasks import host +from tasks import boot +from tasks import bootstrap +from tasks import volume +from tasks import filesystem +from tasks import partitioning +from tasks import cleanup +from tasks import apt +from tasks import security +from tasks import locale base_set = [workspace.CreateWorkspace, bootstrap.AddRequiredCommands, diff --git a/bootstrapvz/common/tasks/apt.py b/bootstrapvz/common/tasks/apt.py index a303600..95b1e34 100644 --- a/bootstrapvz/common/tasks/apt.py +++ b/bootstrapvz/common/tasks/apt.py @@ -1,6 +1,6 @@ -from base import Task -from common import phases -from common.tools import log_check_call +from bootstrapvz.base import Task +from .. import phases +from ..tools import log_check_call import locale import os diff --git a/bootstrapvz/common/tasks/boot.py b/bootstrapvz/common/tasks/boot.py index 6149ace..94545c2 100644 --- a/bootstrapvz/common/tasks/boot.py +++ b/bootstrapvz/common/tasks/boot.py @@ -1,8 +1,8 @@ -from base import Task -from common import phases -from common.tasks import apt -from common.tasks import filesystem -from base.fs import partitionmaps +from bootstrapvz.base import Task +from .. import phases +import apt +import filesystem +from bootstrapvz.base.fs import partitionmaps import os.path @@ -24,7 +24,7 @@ class DisableGetTTYs(Task): @classmethod def run(cls, info): - from common.tools import sed_i + from ..tools import sed_i inittab_path = os.path.join(info.root, 'etc/inittab') tty1 = '1:2345:respawn:/sbin/getty 38400 tty1' sed_i(inittab_path, '^' + tty1, '#' + tty1) @@ -65,13 +65,13 @@ class InstallGrub(Task): @classmethod def run(cls, info): - from common.fs.loopbackvolume import LoopbackVolume - from common.tools import log_check_call + from ..fs.loopbackvolume import LoopbackVolume + from ..tools import log_check_call boot_dir = os.path.join(info.root, 'boot') grub_dir = os.path.join(boot_dir, 'grub') - from common.fs import remount + from ..fs import remount p_map = info.volume.partition_map def link_fn(): @@ -136,7 +136,7 @@ class InstallExtLinux(Task): @classmethod def run(cls, info): - from common.tools import log_check_call + from ..tools import log_check_call if isinstance(info.volume.partition_map, partitionmaps.gpt.GPTPartitionMap): bootloader = '/usr/lib/syslinux/gptmbr.bin' else: diff --git a/bootstrapvz/common/tasks/bootstrap.py b/bootstrapvz/common/tasks/bootstrap.py index 5aa04c4..2274c60 100644 --- a/bootstrapvz/common/tasks/bootstrap.py +++ b/bootstrapvz/common/tasks/bootstrap.py @@ -1,6 +1,6 @@ -from base import Task -from common import phases -from common.exceptions import TaskError +from bootstrapvz.base import Task +from .. import phases +from ..exceptions import TaskError import host import logging log = logging.getLogger(__name__) @@ -45,7 +45,7 @@ class MakeTarball(Task): if os.path.isfile(info.tarball): log.debug('Found matching tarball, skipping download') else: - from common.tools import log_call + from ..tools import log_call status, out, err = log_call(executable + options + ['--make-tarball=' + info.tarball] + arguments) if status != 1: msg = 'debootstrap exited with status {status}, it should exit with status 1'.format(status=status) @@ -63,5 +63,5 @@ class Bootstrap(Task): if hasattr(info, 'tarball'): options.extend(['--unpack-tarball=' + info.tarball]) - from common.tools import log_check_call + from ..tools import log_check_call log_check_call(executable + options + arguments) diff --git a/bootstrapvz/common/tasks/cleanup.py b/bootstrapvz/common/tasks/cleanup.py index cd01854..33957da 100644 --- a/bootstrapvz/common/tasks/cleanup.py +++ b/bootstrapvz/common/tasks/cleanup.py @@ -1,5 +1,5 @@ -from base import Task -from common import phases +from bootstrapvz.base import Task +from .. import phases import os import shutil @@ -28,7 +28,7 @@ class ShredHostkeys(Task): private = [os.path.join(info.root, 'etc/ssh', name) for name in ssh_hostkeys] public = [path + '.pub' for path in private] - from common.tools import log_check_call + from ..tools import log_check_call log_check_call(['shred', '--remove'] + private + public) diff --git a/bootstrapvz/common/tasks/development.py b/bootstrapvz/common/tasks/development.py index b71504d..2fe8e18 100644 --- a/bootstrapvz/common/tasks/development.py +++ b/bootstrapvz/common/tasks/development.py @@ -1,5 +1,5 @@ -from base import Task -from common import phases +from bootstrapvz.base import Task +from .. import phases class TriggerRollback(Task): @@ -9,5 +9,5 @@ class TriggerRollback(Task): @classmethod def run(cls, info): - from common.exceptions import TaskError + from ..exceptions import TaskError raise TaskError('Trigger rollback') diff --git a/bootstrapvz/common/tasks/filesystem.py b/bootstrapvz/common/tasks/filesystem.py index 769ed12..0eb0f7e 100644 --- a/bootstrapvz/common/tasks/filesystem.py +++ b/bootstrapvz/common/tasks/filesystem.py @@ -1,8 +1,8 @@ -from base import Task -from common import phases -from common.tools import log_check_call -from bootstrap import Bootstrap +from bootstrapvz.base import Task +from .. import phases +from ..tools import log_check_call import apt +import bootstrap import host import volume @@ -102,7 +102,7 @@ class MountBoot(Task): class MountSpecials(Task): description = 'Mounting special block devices' phase = phases.os_installation - predecessors = [Bootstrap] + predecessors = [bootstrap.Bootstrap] @classmethod def run(cls, info): diff --git a/bootstrapvz/common/tasks/host.py b/bootstrapvz/common/tasks/host.py index 5544b04..ad58208 100644 --- a/bootstrapvz/common/tasks/host.py +++ b/bootstrapvz/common/tasks/host.py @@ -1,6 +1,6 @@ -from base import Task -from common import phases -from common.exceptions import TaskError +from bootstrapvz.base import Task +from .. import phases +from ..exceptions import TaskError class CheckExternalCommands(Task): @@ -9,7 +9,7 @@ class CheckExternalCommands(Task): @classmethod def run(cls, info): - from common.tools import log_check_call + from ..tools import log_check_call from subprocess import CalledProcessError import re missing_packages = [] diff --git a/bootstrapvz/common/tasks/initd.py b/bootstrapvz/common/tasks/initd.py index 23e2c14..2cf3bc5 100644 --- a/bootstrapvz/common/tasks/initd.py +++ b/bootstrapvz/common/tasks/initd.py @@ -1,7 +1,7 @@ -from base import Task -from common import phases -from common.exceptions import TaskError -from common.tools import log_check_call +from bootstrapvz.base import Task +from .. import phases +from ..exceptions import TaskError +from ..tools import log_check_call from . import assets import os.path @@ -86,7 +86,7 @@ class AdjustExpandRootScript(Task): from base.fs.partitionmaps.none import NoPartitions if not isinstance(info.volume.partition_map, NoPartitions): import os.path - from common.tools import sed_i + from ..tools import sed_i script = os.path.join(info.root, 'etc/init.d.expand-root') root_idx = info.volume.partition_map.root.get_index() device_path = 'device_path="/dev/xvda{idx}"'.format(idx=root_idx) diff --git a/bootstrapvz/common/tasks/locale.py b/bootstrapvz/common/tasks/locale.py index 970e5af..989b2b6 100644 --- a/bootstrapvz/common/tasks/locale.py +++ b/bootstrapvz/common/tasks/locale.py @@ -1,5 +1,5 @@ -from base import Task -from common import phases +from bootstrapvz.base import Task +from .. import phases import os.path @@ -20,8 +20,8 @@ class GenerateLocale(Task): @classmethod def run(cls, info): - from common.tools import sed_i - from common.tools import log_check_call + from ..tools import sed_i + from ..tools import log_check_call locale_gen = os.path.join(info.root, 'etc/locale.gen') locale_str = '{locale}.{charmap} {charmap}'.format(locale=info.manifest.system['locale'], charmap=info.manifest.system['charmap']) diff --git a/bootstrapvz/common/tasks/loopback.py b/bootstrapvz/common/tasks/loopback.py index 8700feb..f251a97 100644 --- a/bootstrapvz/common/tasks/loopback.py +++ b/bootstrapvz/common/tasks/loopback.py @@ -1,5 +1,5 @@ -from base import Task -from common import phases +from bootstrapvz.base import Task +from .. import phases import host import volume @@ -11,11 +11,11 @@ class AddRequiredCommands(Task): @classmethod def run(cls, info): - from common.fs.loopbackvolume import LoopbackVolume + from ..fs.loopbackvolume import LoopbackVolume if isinstance(info.volume, LoopbackVolume): info.host_dependencies['qemu-img'] = 'qemu-utils' info.host_dependencies['losetup'] = 'mount' - from common.fs.qemuvolume import QEMUVolume + from ..fs.qemuvolume import QEMUVolume if isinstance(info.volume, QEMUVolume): info.host_dependencies['losetup'] = 'mount' diff --git a/bootstrapvz/common/tasks/network.py b/bootstrapvz/common/tasks/network.py index 5439718..c175b2d 100644 --- a/bootstrapvz/common/tasks/network.py +++ b/bootstrapvz/common/tasks/network.py @@ -1,5 +1,5 @@ -from base import Task -from common import phases +from bootstrapvz.base import Task +from .. import phases import os @@ -30,7 +30,7 @@ class ConfigureNetworkIF(Task): @classmethod def run(cls, info): network_config_path = os.path.join(os.path.dirname(__file__), 'network-configuration.json') - from common.tools import config_get + from ..tools import config_get if_config = config_get(network_config_path, [info.release_codename]) interfaces_path = os.path.join(info.root, 'etc/network/interfaces') diff --git a/bootstrapvz/common/tasks/packages.py b/bootstrapvz/common/tasks/packages.py index b1a2899..602a2a0 100644 --- a/bootstrapvz/common/tasks/packages.py +++ b/bootstrapvz/common/tasks/packages.py @@ -1,7 +1,7 @@ -from base import Task -from common import phases -from common.tasks import apt -from common.tools import log_check_call +from bootstrapvz.base import Task +from .. import phases +import apt +from ..tools import log_check_call class AddManifestPackages(Task): @@ -41,7 +41,7 @@ class InstallPackages(Task): @classmethod def install_remote(cls, info, remote_packages): import os - from common.tools import log_check_call + from ..tools import log_check_call from subprocess import CalledProcessError try: env = os.environ.copy() diff --git a/bootstrapvz/common/tasks/partitioning.py b/bootstrapvz/common/tasks/partitioning.py index 88a8ebc..db75263 100644 --- a/bootstrapvz/common/tasks/partitioning.py +++ b/bootstrapvz/common/tasks/partitioning.py @@ -1,5 +1,5 @@ -from base import Task -from common import phases +from bootstrapvz.base import Task +from bootstrapvz.common import phases import filesystem import host import volume @@ -12,7 +12,7 @@ class AddRequiredCommands(Task): @classmethod def run(cls, info): - from base.fs.partitionmaps.none import NoPartitions + from bootstrapvz.base.fs.partitionmaps.none import NoPartitions if not isinstance(info.volume.partition_map, NoPartitions): info.host_dependencies['parted'] = 'parted' info.host_dependencies['kpartx'] = 'kpartx' diff --git a/bootstrapvz/common/tasks/security.py b/bootstrapvz/common/tasks/security.py index e4339ba..37bd575 100644 --- a/bootstrapvz/common/tasks/security.py +++ b/bootstrapvz/common/tasks/security.py @@ -1,5 +1,5 @@ -from base import Task -from common import phases +from bootstrapvz.base import Task +from .. import phases import os.path @@ -9,7 +9,7 @@ class EnableShadowConfig(Task): @classmethod def run(cls, info): - from common.tools import log_check_call + from ..tools import log_check_call log_check_call(['chroot', info.root, 'shadowconfig', 'on']) @@ -19,7 +19,7 @@ class DisableSSHPasswordAuthentication(Task): @classmethod def run(cls, info): - from common.tools import sed_i + from ..tools import sed_i sshd_config_path = os.path.join(info.root, 'etc/ssh/sshd_config') sed_i(sshd_config_path, '^#PasswordAuthentication yes', 'PasswordAuthentication no') diff --git a/bootstrapvz/common/tasks/volume.py b/bootstrapvz/common/tasks/volume.py index 797886b..337d6b7 100644 --- a/bootstrapvz/common/tasks/volume.py +++ b/bootstrapvz/common/tasks/volume.py @@ -1,6 +1,6 @@ -from base import Task -from common import phases -from common.tasks import workspace +from bootstrapvz.base import Task +from .. import phases +import workspace class Attach(Task): diff --git a/bootstrapvz/common/tasks/workspace.py b/bootstrapvz/common/tasks/workspace.py index b840a26..bd1ddac 100644 --- a/bootstrapvz/common/tasks/workspace.py +++ b/bootstrapvz/common/tasks/workspace.py @@ -1,5 +1,5 @@ -from base import Task -from common import phases +from bootstrapvz.base import Task +from .. import phases class CreateWorkspace(Task): diff --git a/bootstrapvz/plugins/admin_user/__init__.py b/bootstrapvz/plugins/admin_user/__init__.py index 2a3c56b..67f3488 100644 --- a/bootstrapvz/plugins/admin_user/__init__.py +++ b/bootstrapvz/plugins/admin_user/__init__.py @@ -8,7 +8,7 @@ def validate_manifest(data, validator, error): def resolve_tasks(taskset, manifest): import tasks - from providers.ec2.tasks import initd + from bootstrapvz.providers.ec2.tasks import initd if initd.AddEC2InitScripts in taskset: taskset.add(tasks.AdminUserCredentials) diff --git a/bootstrapvz/plugins/admin_user/tasks.py b/bootstrapvz/plugins/admin_user/tasks.py index ab0131d..5266f27 100644 --- a/bootstrapvz/plugins/admin_user/tasks.py +++ b/bootstrapvz/plugins/admin_user/tasks.py @@ -1,7 +1,7 @@ -from base import Task -from common import phases -from common.tasks.initd import InstallInitScripts -from common.tasks import apt +from bootstrapvz.base import Task +from bootstrapvz.common import phases +from bootstrapvz.common.tasks.initd import InstallInitScripts +from bootstrapvz.common.tasks import apt import os @@ -21,7 +21,7 @@ class CreateAdminUser(Task): @classmethod def run(cls, info): - from common.tools import log_check_call + from bootstrapvz.common.tools import log_check_call log_check_call(['chroot', info.root, 'useradd', '--create-home', '--shell', '/bin/bash', @@ -50,7 +50,7 @@ class AdminUserCredentials(Task): @classmethod def run(cls, info): - from common.tools import sed_i + from bootstrapvz.common.tools import sed_i getcreds_path = os.path.join(info.root, 'etc/init.d/ec2-get-credentials') username = info.manifest.plugins['admin_user']['username'] sed_i(getcreds_path, 'username=\'root\'', 'username=\'{username}\''.format(username=username)) @@ -63,11 +63,11 @@ class DisableRootLogin(Task): @classmethod def run(cls, info): from subprocess import CalledProcessError - from common.tools import log_check_call + from bootstrapvz.common.tools import log_check_call try: log_check_call(['chroot', info.root, 'dpkg-query', '-W', 'openssh-server']) - from common.tools import sed_i + from bootstrapvz.common.tools import sed_i sshdconfig_path = os.path.join(info.root, 'etc/ssh/sshd_config') sed_i(sshdconfig_path, 'PermitRootLogin yes', 'PermitRootLogin no') except CalledProcessError: diff --git a/bootstrapvz/plugins/build_metadata/tasks.py b/bootstrapvz/plugins/build_metadata/tasks.py index f47ad4f..d459721 100644 --- a/bootstrapvz/plugins/build_metadata/tasks.py +++ b/bootstrapvz/plugins/build_metadata/tasks.py @@ -1,5 +1,5 @@ -from base import Task -from common import phases +from bootstrapvz.base import Task +from bootstrapvz.common import phases class WriteMetadata(Task): diff --git a/bootstrapvz/plugins/cloud_init/__init__.py b/bootstrapvz/plugins/cloud_init/__init__.py index 81eee83..e1df533 100644 --- a/bootstrapvz/plugins/cloud_init/__init__.py +++ b/bootstrapvz/plugins/cloud_init/__init__.py @@ -8,8 +8,8 @@ def validate_manifest(data, validator, error): def resolve_tasks(taskset, manifest): import tasks - import providers.ec2.tasks.initd as initd_ec2 - from common.tasks import initd + import bootstrapvz.providers.ec2.tasks.initd as initd_ec2 + from bootstrapvz.common.tasks import initd if manifest.system['release'] in ['wheezy', 'stable']: taskset.add(tasks.AddBackports) diff --git a/bootstrapvz/plugins/cloud_init/tasks.py b/bootstrapvz/plugins/cloud_init/tasks.py index b4a6932..51a9f2f 100644 --- a/bootstrapvz/plugins/cloud_init/tasks.py +++ b/bootstrapvz/plugins/cloud_init/tasks.py @@ -1,7 +1,7 @@ -from base import Task -from common import phases -from common.tools import log_check_call -from common.tasks import apt +from bootstrapvz.base import Task +from bootstrapvz.common import phases +from bootstrapvz.common.tools import log_check_call +from bootstrapvz.common.tasks import apt import os.path @@ -40,7 +40,7 @@ class SetUsername(Task): @classmethod def run(cls, info): - from common.tools import sed_i + from bootstrapvz.common.tools import sed_i cloud_cfg = os.path.join(info.root, 'etc/cloud/cloud.cfg') username = info.manifest.plugins['cloud_init']['username'] search = '^ name: debian$' diff --git a/bootstrapvz/plugins/image_commands/tasks.py b/bootstrapvz/plugins/image_commands/tasks.py index 1c8e3e4..70ec370 100644 --- a/bootstrapvz/plugins/image_commands/tasks.py +++ b/bootstrapvz/plugins/image_commands/tasks.py @@ -1,5 +1,5 @@ -from base import Task -from common import phases +from bootstrapvz.base import Task +from bootstrapvz.common import phases class ImageExecuteCommand(Task): @@ -8,7 +8,7 @@ class ImageExecuteCommand(Task): @classmethod def run(cls, info): - from common.tools import log_check_call + from bootstrapvz.common.tools import log_check_call for raw_command in info.manifest.plugins['image_commands']['commands']: command = map(lambda part: part.format(root=info.root, **info.manifest_vars), raw_command) log_check_call(command) diff --git a/bootstrapvz/plugins/minimize_size/tasks.py b/bootstrapvz/plugins/minimize_size/tasks.py index 161cefd..a9b4fc2 100644 --- a/bootstrapvz/plugins/minimize_size/tasks.py +++ b/bootstrapvz/plugins/minimize_size/tasks.py @@ -1,11 +1,11 @@ -from base import Task -from common import phases -from common.tasks import apt -from common.tasks import bootstrap -from common.tasks import filesystem -from common.tasks import host -from common.tasks import partitioning -from common.tasks import volume +from bootstrapvz.base import Task +from bootstrapvz.common import phases +from bootstrapvz.common.tasks import apt +from bootstrapvz.common.tasks import bootstrap +from bootstrapvz.common.tasks import filesystem +from bootstrapvz.common.tasks import host +from bootstrapvz.common.tasks import partitioning +from bootstrapvz.common.tasks import volume import os folders = ['tmp', 'var/lib/apt/lists'] @@ -69,7 +69,7 @@ class Zerofree(Task): @classmethod def run(cls, info): - from common.tools import log_check_call + from bootstrapvz.common.tools import log_check_call log_check_call(['zerofree', info.volume.partition_map.root.device_path]) @@ -80,5 +80,5 @@ class ShrinkVolume(Task): @classmethod def run(cls, info): - from common.tools import log_check_call + from bootstrapvz.common.tools import log_check_call log_check_call(['/usr/bin/vmware-vdiskmanager', '-k', info.volume.image_path]) diff --git a/bootstrapvz/plugins/opennebula/tasks.py b/bootstrapvz/plugins/opennebula/tasks.py index eb2ee60..202c5a2 100644 --- a/bootstrapvz/plugins/opennebula/tasks.py +++ b/bootstrapvz/plugins/opennebula/tasks.py @@ -1,6 +1,6 @@ -from base import Task -from common.tasks import apt -from common import phases +from bootstrapvz.base import Task +from bootstrapvz.common.tasks import apt +from bootstrapvz.common import phases import os diff --git a/bootstrapvz/plugins/prebootstrapped/__init__.py b/bootstrapvz/plugins/prebootstrapped/__init__.py index 1c7b024..c0bafe7 100644 --- a/bootstrapvz/plugins/prebootstrapped/__init__.py +++ b/bootstrapvz/plugins/prebootstrapped/__init__.py @@ -2,15 +2,15 @@ from tasks import Snapshot from tasks import CopyImage from tasks import CreateFromSnapshot from tasks import CreateFromImage -from providers.ec2.tasks import ebs -from providers.virtualbox.tasks import guest_additions -from common.tasks import loopback -from common.tasks import volume -from common.tasks import locale -from common.tasks import apt -from common.tasks import bootstrap -from common.tasks import filesystem -from common.tasks import partitioning +from bootstrapvz.providers.ec2.tasks import ebs +from bootstrapvz.providers.virtualbox.tasks import guest_additions +from bootstrapvz.common.tasks import loopback +from bootstrapvz.common.tasks import volume +from bootstrapvz.common.tasks import locale +from bootstrapvz.common.tasks import apt +from bootstrapvz.common.tasks import bootstrap +from bootstrapvz.common.tasks import filesystem +from bootstrapvz.common.tasks import partitioning def validate_manifest(data, validator, error): diff --git a/bootstrapvz/plugins/prebootstrapped/tasks.py b/bootstrapvz/plugins/prebootstrapped/tasks.py index 047cf31..018f88e 100644 --- a/bootstrapvz/plugins/prebootstrapped/tasks.py +++ b/bootstrapvz/plugins/prebootstrapped/tasks.py @@ -1,10 +1,10 @@ -from base import Task -from common import phases -from common.tasks import volume -from common.tasks import packages -from providers.virtualbox.tasks import guest_additions -from providers.ec2.tasks import ebs -from common.fs import remount +from bootstrapvz.base import Task +from bootstrapvz.common import phases +from bootstrapvz.common.tasks import volume +from bootstrapvz.common.tasks import packages +from bootstrapvz.providers.virtualbox.tasks import guest_additions +from bootstrapvz.providers.ec2.tasks import ebs +from bootstrapvz.common.fs import remount from shutil import copyfile import os.path import time @@ -81,7 +81,7 @@ def set_fs_states(volume): p_map = volume.partition_map partitions_state = 'attached' - from base.fs.partitionmaps.none import NoPartitions + from bootstrapvz.base.fs.partitionmaps.none import NoPartitions if isinstance(p_map, NoPartitions): partitions_state = 'formatted' else: diff --git a/bootstrapvz/plugins/puppet/tasks.py b/bootstrapvz/plugins/puppet/tasks.py index abc90cb..844424f 100644 --- a/bootstrapvz/plugins/puppet/tasks.py +++ b/bootstrapvz/plugins/puppet/tasks.py @@ -1,7 +1,7 @@ -from base import Task -from common import phases -from common.tasks import apt -from common.tasks import network +from bootstrapvz.base import Task +from bootstrapvz.common import phases +from bootstrapvz.common.tasks import apt +from bootstrapvz.common.tasks import network import os @@ -11,7 +11,7 @@ class CheckAssetsPath(Task): @classmethod def run(cls, info): - from common.exceptions import TaskError + from bootstrapvz.common.exceptions import TaskError assets = info.manifest.plugins['puppet']['assets'] if not os.path.exists(assets): msg = 'The assets directory {assets} does not exist.'.format(assets=assets) @@ -27,7 +27,7 @@ class CheckManifestPath(Task): @classmethod def run(cls, info): - from common.exceptions import TaskError + from bootstrapvz.common.exceptions import TaskError manifest = info.manifest.plugins['puppet']['manifest'] if not os.path.exists(manifest): msg = 'The manifest file {manifest} does not exist.'.format(manifest=manifest) @@ -77,12 +77,12 @@ class ApplyPuppetManifest(Task): copy(pp_manifest, manifest_dst) manifest_path = os.path.join('/', manifest_rel_dst) - from common.tools import log_check_call + from bootstrapvz.common.tools import log_check_call log_check_call(['chroot', info.root, 'puppet', 'apply', manifest_path]) os.remove(manifest_dst) - from common.tools import sed_i + from bootstrapvz.common.tools import sed_i hosts_path = os.path.join(info.root, 'etc/hosts') sed_i(hosts_path, '127.0.0.1\s*{hostname}\n?'.format(hostname=hostname), '') diff --git a/bootstrapvz/plugins/root_password/__init__.py b/bootstrapvz/plugins/root_password/__init__.py index 947b1b5..e93aa90 100644 --- a/bootstrapvz/plugins/root_password/__init__.py +++ b/bootstrapvz/plugins/root_password/__init__.py @@ -7,7 +7,7 @@ def validate_manifest(data, validator, error): def resolve_tasks(taskset, manifest): - from common.tasks.security import DisableSSHPasswordAuthentication + from bootstrapvz.common.tasks.security import DisableSSHPasswordAuthentication from tasks import SetRootPassword taskset.discard(DisableSSHPasswordAuthentication) taskset.add(SetRootPassword) diff --git a/bootstrapvz/plugins/root_password/tasks.py b/bootstrapvz/plugins/root_password/tasks.py index 53ad7fe..359a0d4 100644 --- a/bootstrapvz/plugins/root_password/tasks.py +++ b/bootstrapvz/plugins/root_password/tasks.py @@ -1,5 +1,5 @@ -from base import Task -from common import phases +from bootstrapvz.base import Task +from bootstrapvz.common import phases class SetRootPassword(Task): @@ -8,6 +8,6 @@ class SetRootPassword(Task): @classmethod def run(cls, info): - from common.tools import log_check_call + from bootstrapvz.common.tools import log_check_call log_check_call(['chroot', info.root, 'chpasswd'], 'root:' + info.manifest.plugins['root_password']['password']) diff --git a/bootstrapvz/plugins/unattended_upgrades/tasks.py b/bootstrapvz/plugins/unattended_upgrades/tasks.py index 2bb485a..1299588 100644 --- a/bootstrapvz/plugins/unattended_upgrades/tasks.py +++ b/bootstrapvz/plugins/unattended_upgrades/tasks.py @@ -1,6 +1,6 @@ -from base import Task -from common import phases -from common.tasks import apt +from bootstrapvz.base import Task +from bootstrapvz.common import phases +from bootstrapvz.common.tasks import apt class AddUnattendedUpgradesPackage(Task): diff --git a/bootstrapvz/plugins/vagrant/__init__.py b/bootstrapvz/plugins/vagrant/__init__.py index b0af5d3..f657f50 100644 --- a/bootstrapvz/plugins/vagrant/__init__.py +++ b/bootstrapvz/plugins/vagrant/__init__.py @@ -8,14 +8,14 @@ def validate_manifest(data, validator, error): def resolve_tasks(taskset, manifest): - from common.tasks import security - from common.tasks import loopback - from common.tasks import network + from bootstrapvz.common.tasks import security + from bootstrapvz.common.tasks import loopback + from bootstrapvz.common.tasks import network taskset.discard(security.DisableSSHPasswordAuthentication) taskset.discard(loopback.MoveImage) taskset.discard(network.RemoveHostname) - from common.tasks import volume + from bootstrapvz.common.tasks import volume taskset.update([tasks.CheckBoxPath, tasks.CreateVagrantBoxDir, tasks.AddPackages, diff --git a/bootstrapvz/plugins/vagrant/tasks.py b/bootstrapvz/plugins/vagrant/tasks.py index 2d7e178..94e7805 100644 --- a/bootstrapvz/plugins/vagrant/tasks.py +++ b/bootstrapvz/plugins/vagrant/tasks.py @@ -1,7 +1,7 @@ -from base import Task -from common import phases -from common.tasks import workspace -from common.tasks import apt +from bootstrapvz.base import Task +from bootstrapvz.common import phases +from bootstrapvz.common.tasks import workspace +from bootstrapvz.common.tasks import apt import os import shutil @@ -18,7 +18,7 @@ class CheckBoxPath(Task): box_name = '{name}.box'.format(name=box_basename) box_path = os.path.join(info.manifest.bootstrapper['workspace'], box_name) if os.path.exists(box_path): - from common.exceptions import TaskError + from bootstrapvz.common.exceptions import TaskError msg = 'The vagrant box `{name}\' already exists at `{path}\''.format(name=box_name, path=box_path) raise TaskError(msg) info.vagrant = {'box_name': box_name, @@ -60,7 +60,7 @@ class SetHostname(Task): hostname_file.write(hostname) hosts_path = os.path.join(info.root, 'etc/hosts') - from common.tools import sed_i + from bootstrapvz.common.tools import sed_i sed_i(hosts_path, '^127.0.0.1\tlocalhost$', '127.0.0.1\tlocalhost\n127.0.0.1\t' + hostname) @@ -70,7 +70,7 @@ class CreateVagrantUser(Task): @classmethod def run(cls, info): - from common.tools import log_check_call + from bootstrapvz.common.tools import log_check_call log_check_call(['chroot', info.root, 'useradd', '--create-home', '--shell', '/bin/bash', @@ -114,7 +114,7 @@ class AddInsecurePublicKey(Task): os.chmod(authorized_keys_path, stat.S_IRUSR | stat.S_IWUSR) # We can't do this directly with python, since getpwnam gets its info from the host - from common.tools import log_check_call + from bootstrapvz.common.tools import log_check_call log_check_call(['chroot', info.root, 'chown', 'vagrant:vagrant', '/home/vagrant/.ssh', '/home/vagrant/.ssh/authorized_keys']) @@ -126,7 +126,7 @@ class SetRootPassword(Task): @classmethod def run(cls, info): - from common.tools import log_check_call + from bootstrapvz.common.tools import log_check_call log_check_call(['chroot', info.root, 'chpasswd'], 'root:vagrant') @@ -142,14 +142,14 @@ class PackageBox(Task): import random mac_address = '080027{mac:06X}'.format(mac=random.randrange(16 ** 6)) - from common.tools import sed_i + from bootstrapvz.common.tools import sed_i sed_i(vagrantfile, '\\[MAC_ADDRESS\\]', mac_address) metadata_source = os.path.join(assets, 'metadata.json') metadata = os.path.join(info.vagrant['folder'], 'metadata.json') shutil.copy(metadata_source, metadata) - from common.tools import log_check_call + from bootstrapvz.common.tools import log_check_call disk_name = 'box-disk1.{ext}'.format(ext=info.volume.extension) disk_link = os.path.join(info.vagrant['folder'], disk_name) log_check_call(['ln', '-s', info.volume.image_path, disk_link]) diff --git a/bootstrapvz/providers/ec2/__init__.py b/bootstrapvz/providers/ec2/__init__.py index 243dbd8..9272d2c 100644 --- a/bootstrapvz/providers/ec2/__init__.py +++ b/bootstrapvz/providers/ec2/__init__.py @@ -7,17 +7,17 @@ import tasks.filesystem import tasks.boot import tasks.network import tasks.initd -from common.tasks import volume -from common.tasks import filesystem -from common.tasks import boot -from common.tasks import network -from common.tasks import initd -from common.tasks import partitioning -from common.tasks import loopback -from common.tasks import bootstrap -from common.tasks import security -from common.tasks import cleanup -from common.tasks import workspace +from bootstrapvz.common.tasks import volume +from bootstrapvz.common.tasks import filesystem +from bootstrapvz.common.tasks import boot +from bootstrapvz.common.tasks import network +from bootstrapvz.common.tasks import initd +from bootstrapvz.common.tasks import partitioning +from bootstrapvz.common.tasks import loopback +from bootstrapvz.common.tasks import bootstrap +from bootstrapvz.common.tasks import security +from bootstrapvz.common.tasks import cleanup +from bootstrapvz.common.tasks import workspace def initialize(): @@ -30,7 +30,7 @@ def validate_manifest(data, validator, error): import os.path validator(data, os.path.join(os.path.dirname(__file__), 'manifest-schema.json')) - from common.bytes import Bytes + from bootstrapvz.common.bytes import Bytes if data['volume']['backing'] == 'ebs': volume_size = Bytes(0) for key, partition in data['volume']['partitions'].iteritems(): @@ -51,15 +51,15 @@ def validate_manifest(data, validator, error): def resolve_tasks(taskset, manifest): - import common.task_sets - taskset.update(common.task_sets.base_set) - taskset.update(common.task_sets.mounting_set) - taskset.update(common.task_sets.get_apt_set(manifest)) - taskset.update(common.task_sets.locale_set) - taskset.update(common.task_sets.ssh_set) + from bootstrapvz.common import task_sets + taskset.update(task_sets.base_set) + taskset.update(task_sets.mounting_set) + taskset.update(task_sets.get_apt_set(manifest)) + taskset.update(task_sets.locale_set) + taskset.update(task_sets.ssh_set) if manifest.volume['partitions']['type'] != 'none': - taskset.update(common.task_sets.partitioning_set) + taskset.update(task_sets.partitioning_set) taskset.update([tasks.host.AddExternalCommands, tasks.packages.DefaultPackages, @@ -91,7 +91,7 @@ def resolve_tasks(taskset, manifest): taskset.add(boot.AddGrubPackage) taskset.add(tasks.boot.ConfigurePVGrub) else: - taskset.update(common.task_sets.bootloader_set.get(manifest.system['bootloader'])) + taskset.update(task_sets.bootloader_set.get(manifest.system['bootloader'])) backing_specific_tasks = {'ebs': [tasks.ebs.Create, tasks.ebs.Attach, @@ -113,10 +113,10 @@ def resolve_tasks(taskset, manifest): if manifest.bootstrapper.get('tarball', False): taskset.add(bootstrap.MakeTarball) - taskset.update(common.task_sets.get_fs_specific_set(manifest.volume['partitions'])) + taskset.update(task_sets.get_fs_specific_set(manifest.volume['partitions'])) if 'boot' in manifest.volume['partitions']: - taskset.update(common.task_sets.boot_partition_set) + taskset.update(task_sets.boot_partition_set) def resolve_rollback_tasks(taskset, manifest, counter_task): diff --git a/bootstrapvz/providers/ec2/ebsvolume.py b/bootstrapvz/providers/ec2/ebsvolume.py index 8cbcdbf..0738c60 100644 --- a/bootstrapvz/providers/ec2/ebsvolume.py +++ b/bootstrapvz/providers/ec2/ebsvolume.py @@ -1,5 +1,5 @@ -from base.fs.volume import Volume -from base.fs.exceptions import VolumeError +from bootstrapvz.base.fs.volume import Volume +from bootstrapvz.base.fs.exceptions import VolumeError import time diff --git a/bootstrapvz/providers/ec2/tasks/ami.py b/bootstrapvz/providers/ec2/tasks/ami.py index f77327f..d023df5 100644 --- a/bootstrapvz/providers/ec2/tasks/ami.py +++ b/bootstrapvz/providers/ec2/tasks/ami.py @@ -1,9 +1,9 @@ -from base import Task -from common import phases -from common.exceptions import TaskError -from common.tools import log_check_call +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 ebs import Snapshot -from common.tasks import workspace +from bootstrapvz.common.tasks import workspace from connection import Connect from . import assets import os.path @@ -118,7 +118,7 @@ class RegisterAMI(Task): else: registration_params['virtualization_type'] = 'paravirtual' akis_path = os.path.join(os.path.dirname(__file__), 'ami-akis.json') - from common.tools import config_get + from bootstrapvz.common.tools import config_get registration_params['kernel_id'] = config_get(akis_path, [info.host['region'], info.manifest.system['architecture']]) diff --git a/bootstrapvz/providers/ec2/tasks/boot.py b/bootstrapvz/providers/ec2/tasks/boot.py index 7c7c1e3..3e27eb3 100644 --- a/bootstrapvz/providers/ec2/tasks/boot.py +++ b/bootstrapvz/providers/ec2/tasks/boot.py @@ -1,5 +1,5 @@ -from base import Task -from common import phases +from bootstrapvz.base import Task +from bootstrapvz.common import phases from . import assets import os @@ -26,9 +26,9 @@ class ConfigurePVGrub(Task): copy(script_src, script_dst) os.chmod(script_dst, rwxr_xr_x) - from base.fs.partitionmaps.none import NoPartitions + from bootstrapvz.base.fs.partitionmaps.none import NoPartitions if not isinstance(info.volume.partition_map, NoPartitions): - from common.tools import sed_i + from bootstrapvz.common.tools import sed_i root_idx = info.volume.partition_map.root.get_index() grub_device = 'GRUB_DEVICE=/dev/xvda{idx}'.format(idx=root_idx) sed_i(script_dst, '^GRUB_DEVICE=/dev/xvda$', grub_device) @@ -36,15 +36,15 @@ class ConfigurePVGrub(Task): sed_i(script_dst, '^\troot \(hd0\)$', grub_root) if info.manifest.volume['backing'] == 's3': - from common.tools import sed_i + from bootstrapvz.common.tools import sed_i sed_i(script_dst, '^GRUB_DEVICE=/dev/xvda$', 'GRUB_DEVICE=/dev/xvda1') - from common.tools import sed_i + from bootstrapvz.common.tools import sed_i grub_def = os.path.join(info.root, 'etc/default/grub') sed_i(grub_def, '^GRUB_TIMEOUT=[0-9]+', 'GRUB_TIMEOUT=0\n' 'GRUB_HIDDEN_TIMEOUT=true') - from common.tools import log_check_call + from bootstrapvz.common.tools import log_check_call log_check_call(['chroot', info.root, 'update-grub']) log_check_call(['chroot', info.root, 'ln', '--symbolic', '/boot/grub/grub.cfg', '/boot/grub/menu.lst']) diff --git a/bootstrapvz/providers/ec2/tasks/connection.py b/bootstrapvz/providers/ec2/tasks/connection.py index 73d8f8d..a776a3e 100644 --- a/bootstrapvz/providers/ec2/tasks/connection.py +++ b/bootstrapvz/providers/ec2/tasks/connection.py @@ -1,5 +1,5 @@ -from base import Task -from common import phases +from bootstrapvz.base import Task +from bootstrapvz.common import phases import host diff --git a/bootstrapvz/providers/ec2/tasks/ebs.py b/bootstrapvz/providers/ec2/tasks/ebs.py index b5f3fe8..e11c8cb 100644 --- a/bootstrapvz/providers/ec2/tasks/ebs.py +++ b/bootstrapvz/providers/ec2/tasks/ebs.py @@ -1,5 +1,5 @@ -from base import Task -from common import phases +from bootstrapvz.base import Task +from bootstrapvz.common import phases class Create(Task): diff --git a/bootstrapvz/providers/ec2/tasks/filesystem.py b/bootstrapvz/providers/ec2/tasks/filesystem.py index 9a77049..3e3dce4 100644 --- a/bootstrapvz/providers/ec2/tasks/filesystem.py +++ b/bootstrapvz/providers/ec2/tasks/filesystem.py @@ -1,5 +1,5 @@ -from base import Task -from common import phases +from bootstrapvz.base import Task +from bootstrapvz.common import phases class S3FStab(Task): diff --git a/bootstrapvz/providers/ec2/tasks/host.py b/bootstrapvz/providers/ec2/tasks/host.py index 355e576..7701ef5 100644 --- a/bootstrapvz/providers/ec2/tasks/host.py +++ b/bootstrapvz/providers/ec2/tasks/host.py @@ -1,6 +1,6 @@ -from base import Task -from common import phases -from common.tasks import host +from bootstrapvz.base import Task +from bootstrapvz.common import phases +from bootstrapvz.common.tasks import host class AddExternalCommands(Task): diff --git a/bootstrapvz/providers/ec2/tasks/initd.py b/bootstrapvz/providers/ec2/tasks/initd.py index 88b0121..82a9902 100644 --- a/bootstrapvz/providers/ec2/tasks/initd.py +++ b/bootstrapvz/providers/ec2/tasks/initd.py @@ -1,6 +1,6 @@ -from base import Task -from common import phases -from common.tasks import initd +from bootstrapvz.base import Task +from bootstrapvz.common import phases +from bootstrapvz.common.tasks import initd from . import assets import os.path diff --git a/bootstrapvz/providers/ec2/tasks/network.py b/bootstrapvz/providers/ec2/tasks/network.py index 6c13a32..8d3f695 100644 --- a/bootstrapvz/providers/ec2/tasks/network.py +++ b/bootstrapvz/providers/ec2/tasks/network.py @@ -1,6 +1,6 @@ -from base import Task -from common import phases -from common.tasks import apt +from bootstrapvz.base import Task +from bootstrapvz.common import phases +from bootstrapvz.common.tasks import apt import os.path @@ -12,7 +12,7 @@ class EnableDHCPCDDNS(Task): def run(cls, info): # The dhcp client that ships with debian sets the DNS servers per default. # For dhcpcd we need to configure it to do that. - from common.tools import sed_i + from bootstrapvz.common.tools import sed_i dhcpcd = os.path.join(info.root, 'etc/default/dhcpcd') sed_i(dhcpcd, '^#*SET_DNS=.*', 'SET_DNS=\'yes\'') @@ -39,7 +39,7 @@ class InstallEnhancedNetworking(Task): import urllib urllib.urlretrieve(drivers_url, archive) - from common.tools import log_check_call + from bootstrapvz.common.tools import log_check_call log_check_call('tar', '--ungzip', '--extract', '--file', archive, diff --git a/bootstrapvz/providers/ec2/tasks/packages.py b/bootstrapvz/providers/ec2/tasks/packages.py index ba2787d..62107cd 100644 --- a/bootstrapvz/providers/ec2/tasks/packages.py +++ b/bootstrapvz/providers/ec2/tasks/packages.py @@ -1,6 +1,6 @@ -from base import Task -from common import phases -from common.tasks import apt +from bootstrapvz.base import Task +from bootstrapvz.common import phases +from bootstrapvz.common.tasks import apt class DefaultPackages(Task): @@ -19,7 +19,7 @@ class DefaultPackages(Task): import os.path kernel_packages_path = os.path.join(os.path.dirname(__file__), 'packages-kernels.json') - from common.tools import config_get + from bootstrapvz.common.tools import config_get kernel_package = config_get(kernel_packages_path, [info.release_codename, info.manifest.system['architecture']]) info.packages.add(kernel_package) diff --git a/bootstrapvz/providers/kvm/__init__.py b/bootstrapvz/providers/kvm/__init__.py index a0fe7b3..313660b 100644 --- a/bootstrapvz/providers/kvm/__init__.py +++ b/bootstrapvz/providers/kvm/__init__.py @@ -1,14 +1,14 @@ import tasks.packages -from common.tasks import volume -from common.tasks import loopback -from common.tasks import partitioning -from common.tasks import filesystem -from common.tasks import bootstrap -from common.tasks import security -from common.tasks import network -from common.tasks import initd -from common.tasks import cleanup -from common.tasks import workspace +from bootstrapvz.common.tasks import volume +from bootstrapvz.common.tasks import loopback +from bootstrapvz.common.tasks import partitioning +from bootstrapvz.common.tasks import filesystem +from bootstrapvz.common.tasks import bootstrap +from bootstrapvz.common.tasks import security +from bootstrapvz.common.tasks import network +from bootstrapvz.common.tasks import initd +from bootstrapvz.common.tasks import cleanup +from bootstrapvz.common.tasks import workspace def initialize(): @@ -25,17 +25,17 @@ def validate_manifest(data, validator, error): def resolve_tasks(tasklist, manifest): - import common.task_sets - tasklist.update(common.task_sets.base_set) - tasklist.update(common.task_sets.volume_set) - tasklist.update(common.task_sets.mounting_set) - tasklist.update(common.task_sets.get_apt_set(manifest)) - tasklist.update(common.task_sets.locale_set) + from bootstrapvz.common import task_sets + tasklist.update(task_sets.base_set) + tasklist.update(task_sets.volume_set) + tasklist.update(task_sets.mounting_set) + tasklist.update(task_sets.get_apt_set(manifest)) + tasklist.update(task_sets.locale_set) - tasklist.update(common.task_sets.bootloader_set.get(manifest.system['bootloader'])) + tasklist.update(task_sets.bootloader_set.get(manifest.system['bootloader'])) if manifest.volume['partitions']['type'] != 'none': - tasklist.update(common.task_sets.partitioning_set) + tasklist.update(task_sets.partitioning_set) tasklist.update([tasks.packages.DefaultPackages, @@ -60,10 +60,10 @@ def resolve_tasks(tasklist, manifest): from tasks import virtio tasklist.update([virtio.VirtIO]) - tasklist.update(common.task_sets.get_fs_specific_set(manifest.volume['partitions'])) + tasklist.update(task_sets.get_fs_specific_set(manifest.volume['partitions'])) if 'boot' in manifest.volume['partitions']: - tasklist.update(common.task_sets.boot_partition_set) + tasklist.update(task_sets.boot_partition_set) def resolve_rollback_tasks(tasklist, manifest, counter_task): diff --git a/bootstrapvz/providers/kvm/tasks/packages.py b/bootstrapvz/providers/kvm/tasks/packages.py index 52d2639..97eec67 100644 --- a/bootstrapvz/providers/kvm/tasks/packages.py +++ b/bootstrapvz/providers/kvm/tasks/packages.py @@ -1,6 +1,6 @@ -from base import Task -from common import phases -from common.tasks import apt +from bootstrapvz.base import Task +from bootstrapvz.common import phases +from bootstrapvz.common.tasks import apt class DefaultPackages(Task): diff --git a/bootstrapvz/providers/kvm/tasks/virtio.py b/bootstrapvz/providers/kvm/tasks/virtio.py index 96c05cb..cb3ae68 100644 --- a/bootstrapvz/providers/kvm/tasks/virtio.py +++ b/bootstrapvz/providers/kvm/tasks/virtio.py @@ -1,5 +1,5 @@ -from base import Task -from common import phases +from bootstrapvz.base import Task +from bootstrapvz.common import phases import os diff --git a/bootstrapvz/providers/virtualbox/__init__.py b/bootstrapvz/providers/virtualbox/__init__.py index 8719b4f..f9fa99b 100644 --- a/bootstrapvz/providers/virtualbox/__init__.py +++ b/bootstrapvz/providers/virtualbox/__init__.py @@ -1,14 +1,14 @@ import tasks.packages -from common.tasks import volume -from common.tasks import loopback -from common.tasks import partitioning -from common.tasks import filesystem -from common.tasks import bootstrap -from common.tasks import security -from common.tasks import network -from common.tasks import initd -from common.tasks import cleanup -from common.tasks import workspace +from bootstrapvz.common.tasks import volume +from bootstrapvz.common.tasks import loopback +from bootstrapvz.common.tasks import partitioning +from bootstrapvz.common.tasks import filesystem +from bootstrapvz.common.tasks import bootstrap +from bootstrapvz.common.tasks import security +from bootstrapvz.common.tasks import network +from bootstrapvz.common.tasks import initd +from bootstrapvz.common.tasks import cleanup +from bootstrapvz.common.tasks import workspace def initialize(): @@ -25,17 +25,17 @@ def validate_manifest(data, validator, error): def resolve_tasks(taskset, manifest): - import common.task_sets - taskset.update(common.task_sets.base_set) - taskset.update(common.task_sets.volume_set) - taskset.update(common.task_sets.mounting_set) - taskset.update(common.task_sets.get_apt_set(manifest)) - taskset.update(common.task_sets.locale_set) + from bootstrapvz.common import task_sets + taskset.update(task_sets.base_set) + taskset.update(task_sets.volume_set) + taskset.update(task_sets.mounting_set) + taskset.update(task_sets.get_apt_set(manifest)) + taskset.update(task_sets.locale_set) - taskset.update(common.task_sets.bootloader_set.get(manifest.system['bootloader'])) + taskset.update(task_sets.bootloader_set.get(manifest.system['bootloader'])) if manifest.volume['partitions']['type'] != 'none': - taskset.update(common.task_sets.partitioning_set) + taskset.update(task_sets.partitioning_set) taskset.update([tasks.packages.DefaultPackages, @@ -63,10 +63,10 @@ def resolve_tasks(taskset, manifest): if manifest.bootstrapper.get('tarball', False): taskset.add(bootstrap.MakeTarball) - taskset.update(common.task_sets.get_fs_specific_set(manifest.volume['partitions'])) + taskset.update(task_sets.get_fs_specific_set(manifest.volume['partitions'])) if 'boot' in manifest.volume['partitions']: - taskset.update(common.task_sets.boot_partition_set) + taskset.update(task_sets.boot_partition_set) def resolve_rollback_tasks(taskset, manifest, counter_task): diff --git a/bootstrapvz/providers/virtualbox/tasks/guest_additions.py b/bootstrapvz/providers/virtualbox/tasks/guest_additions.py index f9c9e16..2ae7c53 100644 --- a/bootstrapvz/providers/virtualbox/tasks/guest_additions.py +++ b/bootstrapvz/providers/virtualbox/tasks/guest_additions.py @@ -1,7 +1,7 @@ -from base import Task -from common import phases -from common.tasks.packages import InstallPackages -from common.exceptions import TaskError +from bootstrapvz.base import Task +from bootstrapvz.common import phases +from bootstrapvz.common.tasks.packages import InstallPackages +from bootstrapvz.common.exceptions import TaskError class CheckGuestAdditionsPath(Task): @@ -28,7 +28,7 @@ class AddGuestAdditionsPackages(Task): info.packages.add('build-essential') info.packages.add('dkms') - from common.tools import log_check_call + from bootstrapvz.common.tools import log_check_call [kernel_version] = log_check_call(['chroot', info.root, 'uname', '-r']) kernel_headers_pkg = 'linux-headers-{version}'.format(version=kernel_version) @@ -52,7 +52,7 @@ class InstallGuestAdditions(Task): install_script = os.path.join('/', mount_dir, 'VBoxLinuxAdditions.run') # Don't check the return code of the scripts here, because 1 not necessarily means they have failed - from common.tools import log_call + from bootstrapvz.common.tools import log_call log_call(['chroot', info.root, install_script, '--nox11']) # VBoxService process could be running, as it is not affected by DisableDaemonAutostart log_call(['chroot', info.root, 'service', 'vboxadd-service', 'stop']) diff --git a/bootstrapvz/providers/virtualbox/tasks/packages.py b/bootstrapvz/providers/virtualbox/tasks/packages.py index 316d5dd..8235c32 100644 --- a/bootstrapvz/providers/virtualbox/tasks/packages.py +++ b/bootstrapvz/providers/virtualbox/tasks/packages.py @@ -1,6 +1,6 @@ -from base import Task -from common import phases -from common.tasks import apt +from bootstrapvz.base import Task +from bootstrapvz.common import phases +from bootstrapvz.common.tasks import apt class DefaultPackages(Task):