mirror of
https://github.com/kevingruesser/bootstrap-vz.git
synced 2025-08-22 18:00:35 +00:00
Only delete files form the image if they exist. Add in an HVM manifest file.
This commit is contained in:
parent
abe70d6df9
commit
b64ad495ab
4 changed files with 53 additions and 4 deletions
|
@ -35,7 +35,9 @@ class CheckHostDependencies(Task):
|
|||
missing_packages = []
|
||||
for package in info.host_dependencies:
|
||||
try:
|
||||
log_check_call(['/usr/bin/dpkg-query', '-s', package])
|
||||
import os.path
|
||||
if os.path.isfile('/usr/bin/dpkg-query'):
|
||||
log_check_call(['/usr/bin/dpkg-query', '-s', package])
|
||||
except CalledProcessError:
|
||||
missing_packages.append(package)
|
||||
if len(missing_packages) > 0:
|
||||
|
|
|
@ -10,7 +10,9 @@ class RemoveDNSInfo(Task):
|
|||
@classmethod
|
||||
def run(cls, info):
|
||||
from os import remove
|
||||
remove(os.path.join(info.root, 'etc/resolv.conf'))
|
||||
import os.path
|
||||
if os.path.isfile(os.path.join(info.root, 'etc/resolv.conf')):
|
||||
remove(os.path.join(info.root, 'etc/resolv.conf'))
|
||||
|
||||
|
||||
class RemoveHostname(Task):
|
||||
|
@ -20,7 +22,9 @@ class RemoveHostname(Task):
|
|||
@classmethod
|
||||
def run(cls, info):
|
||||
from os import remove
|
||||
remove(os.path.join(info.root, 'etc/hostname'))
|
||||
import os.path
|
||||
if os.path.isfile(os.path.join(info.root, 'etc/hostname')):
|
||||
remove(os.path.join(info.root, 'etc/hostname'))
|
||||
|
||||
|
||||
class ConfigureNetworkIF(Task):
|
||||
|
|
|
@ -0,0 +1,44 @@
|
|||
{
|
||||
"provider": "ec2",
|
||||
"virtualization": "hvm",
|
||||
"credentials": {
|
||||
// "access-key": null,
|
||||
// "secret-key": null
|
||||
},
|
||||
|
||||
"bootstrapper": {
|
||||
"workspace": "/target"
|
||||
},
|
||||
"image": {
|
||||
"name": "debian-{system.release}-{system.architecture}-{virtualization}-{%Y}-{%m}-{%d}-ebs",
|
||||
"description": "Debian {system.release} {system.architecture}"
|
||||
},
|
||||
"system": {
|
||||
"release": "wheezy",
|
||||
"architecture": "amd64",
|
||||
"bootloader": "extlinux",
|
||||
"timezone": "UTC",
|
||||
"locale": "en_US",
|
||||
"charmap": "UTF-8"
|
||||
},
|
||||
"packages": {
|
||||
"mirror": "http://ftp.cn.debian.org/debian"
|
||||
},
|
||||
"volume": {
|
||||
"backing": "ebs",
|
||||
"partitions": {
|
||||
"type": "none",
|
||||
"root": {
|
||||
"size": "8GiB",
|
||||
"filesystem": "ext4"
|
||||
}
|
||||
}
|
||||
},
|
||||
"plugins": {
|
||||
"cloud_init": {
|
||||
"username": "admin",
|
||||
//"metadata_sources": "Ec2",
|
||||
"disable_modules": [ "landscape", "byobu", "ssh-import-id" ]
|
||||
}
|
||||
}
|
||||
}
|
|
@ -163,7 +163,6 @@ class RegisterAMI(Task):
|
|||
registration_params['virtualization_type'] = 'paravirtual'
|
||||
registration_params['kernel_id'] = (cls.kernel_mapping
|
||||
.get(info.host['region'])
|
||||
.get(grub_boot_device)
|
||||
.get(info.manifest.system['architecture']))
|
||||
|
||||
info.image = info.connection.register_image(**registration_params)
|
||||
|
|
Loading…
Add table
Reference in a new issue