2014-08-31 13:45:35 +02:00
|
|
|
import tools
|
2014-11-25 22:45:03 +01:00
|
|
|
from manifests import partials
|
2014-11-30 14:09:21 +01:00
|
|
|
from bootstrapvz.base.manifest import Manifest
|
2014-11-30 15:54:31 +01:00
|
|
|
from bootstrapvz.remote.build_servers import pick_build_server
|
|
|
|
from . import build_servers
|
2014-12-20 01:21:00 +01:00
|
|
|
from images.virtualbox import VirtualBoxImage
|
|
|
|
from instances.virtualbox import VirtualBoxInstance
|
2014-08-31 13:45:35 +02:00
|
|
|
|
|
|
|
|
|
|
|
def test_virtualbox_unpartitioned_extlinux():
|
2014-11-25 22:45:03 +01:00
|
|
|
import yaml
|
2014-11-30 14:09:21 +01:00
|
|
|
manifest_data = yaml.load("""
|
2014-11-25 22:45:03 +01:00
|
|
|
provider:
|
|
|
|
name: virtualbox
|
|
|
|
system:
|
|
|
|
bootloader: extlinux
|
|
|
|
volume:
|
|
|
|
backing: vdi
|
|
|
|
partitions:
|
|
|
|
type: msdos
|
2014-11-30 00:33:42 +01:00
|
|
|
""")
|
2014-12-20 01:21:00 +01:00
|
|
|
manifest_data = tools.merge_dicts(partials['base'], partials['stable64'], partials['unpartitioned'],
|
|
|
|
partials['root_password'], partials['apt_proxy'],
|
2014-12-19 01:27:16 +01:00
|
|
|
manifest_data)
|
2014-08-31 13:45:35 +02:00
|
|
|
|
2014-11-30 15:54:31 +01:00
|
|
|
build_server = pick_build_server(build_servers, manifest_data)
|
|
|
|
manifest_data = build_server.apply_build_settings(manifest_data)
|
2014-11-30 14:09:21 +01:00
|
|
|
manifest = Manifest(data=manifest_data)
|
2014-08-31 13:45:35 +02:00
|
|
|
|
2014-12-20 01:21:00 +01:00
|
|
|
# bootstrap_info = tools.bootstrap(manifest, build_server)
|
|
|
|
from bootstrapvz.base.bootstrapinfo import BootstrapInformation
|
|
|
|
bootstrap_info = BootstrapInformation(manifest)
|
|
|
|
bootstrap_info.volume.image_path = '/target/debian-wheezy-amd64-141218.vdi'
|
2014-08-31 13:45:35 +02:00
|
|
|
|
2014-12-01 00:09:46 +01:00
|
|
|
from bootstrapvz.remote.build_servers import LocalBuildServer
|
|
|
|
if isinstance(build_server, LocalBuildServer):
|
2014-11-30 00:33:42 +01:00
|
|
|
image_path = bootstrap_info.volume.image_path
|
|
|
|
else:
|
2014-12-20 01:21:00 +01:00
|
|
|
# import tempfile
|
|
|
|
# handle, image_path = tempfile.mkstemp()
|
|
|
|
# import os
|
|
|
|
# os.close(handle)
|
|
|
|
# build_server.download(bootstrap_info.volume.image_path, image_path)
|
|
|
|
# build_server.delete(bootstrap_info.volume.image_path)
|
|
|
|
image_path = '/Users/anders/Workspace/cloud/images/debian-wheezy-amd64-141130.vmdk'
|
2014-11-30 00:33:42 +01:00
|
|
|
|
2014-12-20 01:21:00 +01:00
|
|
|
image = VirtualBoxImage(manifest, image_path)
|
2014-11-30 00:33:42 +01:00
|
|
|
try:
|
2014-12-20 01:21:00 +01:00
|
|
|
instance = VirtualBoxInstance('unpartitioned_extlinux', image)
|
2014-12-14 15:41:04 +01:00
|
|
|
try:
|
|
|
|
instance.create()
|
2014-12-18 21:47:51 +01:00
|
|
|
try:
|
|
|
|
instance.boot()
|
2014-12-19 01:25:38 +01:00
|
|
|
# tools.reachable_with_ssh(instance)
|
2014-12-18 21:47:51 +01:00
|
|
|
finally:
|
|
|
|
instance.shutdown()
|
2014-12-14 15:41:04 +01:00
|
|
|
finally:
|
2014-12-20 01:21:00 +01:00
|
|
|
instance.destroy()
|
2014-11-30 00:33:42 +01:00
|
|
|
finally:
|
2014-12-20 02:25:47 +01:00
|
|
|
image.destroy()
|
|
|
|
import os
|
|
|
|
os.remove(image_path)
|