Cosmetic changes in azure provider

This commit is contained in:
Anders Ingemann 2014-04-08 23:29:45 +02:00
parent 9e748601b3
commit 9e20731c84
3 changed files with 14 additions and 17 deletions

View file

@ -2,6 +2,7 @@ from bootstrapvz.base import Task
from bootstrapvz.common import phases from bootstrapvz.common import phases
from bootstrapvz.common.tasks import boot from bootstrapvz.common.tasks import boot
class ConfigureGrub(Task): class ConfigureGrub(Task):
description = 'Change grub configuration to allow for ttyS0 output' description = 'Change grub configuration to allow for ttyS0 output'
phase = phases.system_modification phase = phases.system_modification
@ -14,4 +15,3 @@ class ConfigureGrub(Task):
grub_config = os.path.join(info.root, 'etc/default/grub') grub_config = os.path.join(info.root, 'etc/default/grub')
sed_i(grub_config, r'^(GRUB_CMDLINE_LINUX*=".*)"\s*$', r'\1console=ttyS0 earlyprintk=ttyS0 rootdelay=300"') sed_i(grub_config, r'^(GRUB_CMDLINE_LINUX*=".*)"\s*$', r'\1console=ttyS0 earlyprintk=ttyS0 rootdelay=300"')
sed_i(grub_config, r'^.*(GRUB_TIMEOUT=).*$', r'GRUB_TIMEOUT=0') sed_i(grub_config, r'^.*(GRUB_TIMEOUT=).*$', r'GRUB_TIMEOUT=0')

View file

@ -15,11 +15,14 @@ class ConvertToVhd(Task):
destination = os.path.join(info.manifest.bootstrapper['workspace'], filename) destination = os.path.join(info.manifest.bootstrapper['workspace'], filename)
file_size = os.path.getsize(info.volume.image_path) file_size = os.path.getsize(info.volume.image_path)
rounded_vol_size = str(((file_size/(1024*1024)+1)*(1024*1024))) rounded_vol_size = str(((file_size / (1024 * 1024) + 1) * (1024 * 1024)))
from bootstrapvz.common.tools import log_check_call from bootstrapvz.common.tools import log_check_call
log_check_call(['qemu-img', 'resize', info.volume.image_path, rounded_vol_size]) log_check_call(['qemu-img', 'resize', info.volume.image_path, rounded_vol_size])
log_check_call(['qemu-img', 'convert', '-o', 'subformat=fixed', '-O', 'vpc', info.volume.image_path, destination]) log_check_call(['qemu-img', 'convert',
'-o', 'subformat=fixed',
'-O', 'vpc',
info.volume.image_path, destination])
os.remove(info.volume.image_path) os.remove(info.volume.image_path)
import logging import logging
log = logging.getLogger(__name__) log = logging.getLogger(__name__)

View file

@ -20,7 +20,7 @@ class DefaultPackages(Task):
info.packages.add('python-pyasn1') info.packages.add('python-pyasn1')
info.packages.add('git') info.packages.add('git')
info.packages.add('sudo') info.packages.add('sudo')
#info.packages.add('waagent')
class Waagent(Task): class Waagent(Task):
description = 'Add waagent' description = 'Add waagent'
@ -33,19 +33,13 @@ class Waagent(Task):
import os import os
env = os.environ.copy() env = os.environ.copy()
env['GIT_SSL_NO_VERIFY'] = 'true' env['GIT_SSL_NO_VERIFY'] = 'true'
status, out, err = log_call(['chroot', info.root, log_call(['chroot', info.root,
'git','clone', 'https://github.com/WindowsAzure/WALinuxAgent.git', 'git', 'clone', 'https://github.com/WindowsAzure/WALinuxAgent.git',
'/root/WALinuxAgent'], env=env) '/root/WALinuxAgent'], env=env)
status, out, err = log_call(['chroot', info.root, log_call(['chroot', info.root, 'cp', '/root/WALinuxAgent/waagent', '/usr/sbin/waagent'])
'cp','/root/WALinuxAgent/waagent','/usr/sbin/waagent']) log_call(['chmod', '755', '/usr/sbin/waagent'])
status, out, err = log_call(['chroot', info.root, log_call(['chroot', info.root, 'waagent', '-install'])
'chmod','755','/usr/sbin/waagent'])
status, out, err = log_call(['chroot', info.root,
'/usr/sbin/waagent','-install'])
import os.path import os.path
if hasattr(info.manifest, 'azure') and info.manifest.azure['waagent']: if hasattr(info.manifest, 'azure') and info.manifest.azure['waagent']:
if os.path.isfile(info.manifest.azure['waagent']): if os.path.isfile(info.manifest.azure['waagent']):
status, out, err = log_call(['cp', log_call(['cp', info.manifest.azure['waagent'], os.path.join(info.root, 'etc/waagent.conf')])
info.manifest.azure['waagent'],
os.path.join(info.root,'etc/waagent.conf')])