2014-04-07 14:23:24 +02:00
|
|
|
from bootstrapvz.base import Task
|
|
|
|
from bootstrapvz.common import phases
|
|
|
|
from bootstrapvz.common.tasks import apt
|
|
|
|
from bootstrapvz.common.tasks.packages import InstallPackages
|
|
|
|
|
|
|
|
|
|
|
|
class DefaultPackages(Task):
|
|
|
|
description = 'Adding image packages required for Azure'
|
|
|
|
phase = phases.preparation
|
|
|
|
predecessors = [apt.AddDefaultSources]
|
|
|
|
|
|
|
|
@classmethod
|
|
|
|
def run(cls, info):
|
|
|
|
kernels = {'amd64': 'linux-image-amd64',
|
|
|
|
'i386': 'linux-image-686', }
|
|
|
|
info.packages.add(kernels.get(info.manifest.system['architecture']))
|
|
|
|
info.packages.add('openssl')
|
|
|
|
info.packages.add('python-openssl')
|
|
|
|
info.packages.add('openssh-server')
|
|
|
|
info.packages.add('python-pyasn1')
|
|
|
|
info.packages.add('git')
|
|
|
|
info.packages.add('sudo')
|
2014-04-08 23:29:45 +02:00
|
|
|
|
2014-04-07 14:23:24 +02:00
|
|
|
|
|
|
|
class Waagent(Task):
|
|
|
|
description = 'Add waagent'
|
|
|
|
phase = phases.package_installation
|
|
|
|
predecessors = [InstallPackages]
|
|
|
|
|
|
|
|
@classmethod
|
|
|
|
def run(cls, info):
|
|
|
|
from bootstrapvz.common.tools import log_call
|
|
|
|
import os
|
|
|
|
env = os.environ.copy()
|
|
|
|
env['GIT_SSL_NO_VERIFY'] = 'true'
|
2014-04-08 23:29:45 +02:00
|
|
|
log_call(['chroot', info.root,
|
|
|
|
'git', 'clone', 'https://github.com/WindowsAzure/WALinuxAgent.git',
|
|
|
|
'/root/WALinuxAgent'], env=env)
|
|
|
|
log_call(['chroot', info.root, 'cp', '/root/WALinuxAgent/waagent', '/usr/sbin/waagent'])
|
|
|
|
log_call(['chmod', '755', '/usr/sbin/waagent'])
|
|
|
|
log_call(['chroot', info.root, 'waagent', '-install'])
|
2014-04-07 14:23:24 +02:00
|
|
|
import os.path
|
|
|
|
if hasattr(info.manifest, 'azure') and info.manifest.azure['waagent']:
|
|
|
|
if os.path.isfile(info.manifest.azure['waagent']):
|
2014-04-08 23:29:45 +02:00
|
|
|
log_call(['cp', info.manifest.azure['waagent'], os.path.join(info.root, 'etc/waagent.conf')])
|