mirror of
https://github.com/kevingruesser/bootstrap-vz.git
synced 2025-08-22 18:00:35 +00:00
Rely on $PATH to resolve commands. Fixes #12
This commit is contained in:
parent
0ef1d3ab69
commit
851389da09
30 changed files with 98 additions and 98 deletions
|
@ -37,13 +37,13 @@ class AbstractPartitionMap(FSMProxy):
|
|||
def _before_map(self, event):
|
||||
volume = event.volume
|
||||
try:
|
||||
mappings = log_check_call(['/sbin/kpartx', '-l', volume.device_path])
|
||||
mappings = log_check_call(['kpartx', '-l', volume.device_path])
|
||||
import re
|
||||
regexp = re.compile('^(?P<name>.+[^\d](?P<p_idx>\d+)) : '
|
||||
'(?P<start_blk>\d) (?P<num_blks>\d+) '
|
||||
'{device_path} (?P<blk_offset>\d+)$'
|
||||
.format(device_path=volume.device_path))
|
||||
log_check_call(['/sbin/kpartx', '-a', volume.device_path])
|
||||
log_check_call(['kpartx', '-a', volume.device_path])
|
||||
import os.path
|
||||
for mapping in mappings:
|
||||
match = regexp.match(mapping)
|
||||
|
@ -61,7 +61,7 @@ class AbstractPartitionMap(FSMProxy):
|
|||
for partition in self.partitions:
|
||||
if not partition.fsm.can('unmap'):
|
||||
partition.unmap()
|
||||
log_check_call(['/sbin/kpartx', '-d', volume.device_path])
|
||||
log_check_call(['kpartx', '-d', volume.device_path])
|
||||
raise e
|
||||
|
||||
def unmap(self, volume):
|
||||
|
@ -73,6 +73,6 @@ class AbstractPartitionMap(FSMProxy):
|
|||
if partition.fsm.cannot('unmap'):
|
||||
msg = 'The partition {partition} prevents the unmap procedure'.format(partition=partition)
|
||||
raise PartitionError(msg)
|
||||
log_check_call(['/sbin/kpartx', '-d', volume.device_path])
|
||||
log_check_call(['kpartx', '-d', volume.device_path])
|
||||
for partition in self.partitions:
|
||||
partition.unmap()
|
||||
|
|
|
@ -46,7 +46,7 @@ class GPTPartitionMap(AbstractPartitionMap):
|
|||
|
||||
def _before_create(self, event):
|
||||
volume = event.volume
|
||||
log_check_call(['/sbin/parted', '--script', '--align', 'none', volume.device_path,
|
||||
log_check_call(['parted', '--script', '--align', 'none', volume.device_path,
|
||||
'--', 'mklabel', 'gpt'])
|
||||
for partition in self.partitions:
|
||||
partition.create(volume)
|
||||
|
|
|
@ -36,7 +36,7 @@ class MSDOSPartitionMap(AbstractPartitionMap):
|
|||
|
||||
def _before_create(self, event):
|
||||
volume = event.volume
|
||||
log_check_call(['/sbin/parted', '--script', '--align', 'none', volume.device_path,
|
||||
log_check_call(['parted', '--script', '--align', 'none', volume.device_path,
|
||||
'--', 'mklabel', 'msdos'])
|
||||
for partition in self.partitions:
|
||||
partition.create(volume)
|
||||
|
|
|
@ -26,14 +26,14 @@ class AbstractPartition(FSMProxy):
|
|||
if isinstance(self.source, AbstractPartition):
|
||||
self.source.mount(destination=mount_dir)
|
||||
else:
|
||||
log_check_call(['/bin/mount'] + self.opts + [self.source, mount_dir])
|
||||
log_check_call(['mount'] + self.opts + [self.source, mount_dir])
|
||||
self.mount_dir = mount_dir
|
||||
|
||||
def unmount(self):
|
||||
if isinstance(self.source, AbstractPartition):
|
||||
self.source.unmount()
|
||||
else:
|
||||
log_check_call(['/bin/umount', self.mount_dir])
|
||||
log_check_call(['umount', self.mount_dir])
|
||||
del self.mount_dir
|
||||
|
||||
def __init__(self, size, filesystem, format_command):
|
||||
|
@ -47,7 +47,7 @@ class AbstractPartition(FSMProxy):
|
|||
super(AbstractPartition, self).__init__(cfg)
|
||||
|
||||
def get_uuid(self):
|
||||
[uuid] = log_check_call(['/sbin/blkid', '-s', 'UUID', '-o', 'value', self.device_path])
|
||||
[uuid] = log_check_call(['blkid', '-s', 'UUID', '-o', 'value', self.device_path])
|
||||
return uuid
|
||||
|
||||
@abstractmethod
|
||||
|
@ -59,7 +59,7 @@ class AbstractPartition(FSMProxy):
|
|||
|
||||
def _before_format(self, e):
|
||||
if self.format_command is None:
|
||||
format_command = ['/sbin/mkfs.{fs}', '{device_path}']
|
||||
format_command = ['mkfs.{fs}', '{device_path}']
|
||||
else:
|
||||
format_command = self.format_command
|
||||
variables = {'fs': self.filesystem,
|
||||
|
@ -70,7 +70,7 @@ class AbstractPartition(FSMProxy):
|
|||
log_check_call(command)
|
||||
|
||||
def _before_mount(self, e):
|
||||
log_check_call(['/bin/mount', '--types', self.filesystem, self.device_path, e.destination])
|
||||
log_check_call(['mount', '--types', self.filesystem, self.device_path, e.destination])
|
||||
self.mount_dir = e.destination
|
||||
|
||||
def _after_mount(self, e):
|
||||
|
@ -80,7 +80,7 @@ class AbstractPartition(FSMProxy):
|
|||
def _before_unmount(self, e):
|
||||
for destination in sorted(self.mounts.iterkeys(), key=len, reverse=True):
|
||||
self.mounts[destination].unmount()
|
||||
log_check_call(['/bin/umount', self.mount_dir])
|
||||
log_check_call(['umount', self.mount_dir])
|
||||
del self.mount_dir
|
||||
|
||||
def add_mount(self, source, destination, opts=[]):
|
||||
|
|
|
@ -44,11 +44,11 @@ class BasePartition(AbstractPartition):
|
|||
create_command = ('mkpart primary {start} {end}'
|
||||
.format(start=str(self.get_start()),
|
||||
end=str(self.get_end())))
|
||||
log_check_call(['/sbin/parted', '--script', '--align', 'none', e.volume.device_path,
|
||||
log_check_call(['parted', '--script', '--align', 'none', e.volume.device_path,
|
||||
'--', create_command])
|
||||
|
||||
for flag in self.flags:
|
||||
log_check_call(['/sbin/parted', '--script', e.volume.device_path,
|
||||
log_check_call(['parted', '--script', e.volume.device_path,
|
||||
'--', ('set {idx} {flag} on'
|
||||
.format(idx=str(self.get_index()), flag=flag))])
|
||||
|
||||
|
|
|
@ -14,5 +14,5 @@ class GPTPartition(BasePartition):
|
|||
name_command = ('name {idx} {name}'
|
||||
.format(idx=self.get_index(),
|
||||
name=self.name))
|
||||
log_check_call(['/sbin/parted', '--script', e.volume.device_path,
|
||||
log_check_call(['parted', '--script', e.volume.device_path,
|
||||
'--', name_command])
|
||||
|
|
|
@ -8,4 +8,4 @@ class GPTSwapPartition(GPTPartition):
|
|||
super(GPTSwapPartition, self).__init__(size, 'swap', None, 'swap', previous)
|
||||
|
||||
def _before_format(self, e):
|
||||
log_check_call(['/sbin/mkswap', self.device_path])
|
||||
log_check_call(['mkswap', self.device_path])
|
||||
|
|
|
@ -8,4 +8,4 @@ class MSDOSSwapPartition(MSDOSPartition):
|
|||
super(MSDOSSwapPartition, self).__init__(size, 'swap', None, previous)
|
||||
|
||||
def _before_format(self, e):
|
||||
log_check_call(['/sbin/mkswap', self.device_path])
|
||||
log_check_call(['mkswap', self.device_path])
|
||||
|
|
|
@ -76,12 +76,12 @@ class Volume(FSMProxy):
|
|||
if not hasattr(self, 'dm_node_name'):
|
||||
raise VolumeError('Unable to find a free block device path for mounting the bootstrap volume')
|
||||
|
||||
log_check_call(['/sbin/dmsetup', 'create', self.dm_node_name], table)
|
||||
log_check_call(['dmsetup', 'create', self.dm_node_name], table)
|
||||
self.unlinked_device_path = self.device_path
|
||||
self.device_path = self.dm_node_path
|
||||
|
||||
def _before_unlink_dm_node(self, e):
|
||||
log_check_call(['/sbin/dmsetup', 'remove', self.dm_node_name])
|
||||
log_check_call(['dmsetup', 'remove', self.dm_node_name])
|
||||
del self.dm_node_name
|
||||
del self.dm_node_path
|
||||
self.device_path = self.unlinked_device_path
|
||||
|
|
|
@ -12,14 +12,14 @@ class LoopbackVolume(Volume):
|
|||
def _before_create(self, e):
|
||||
self.image_path = e.image_path
|
||||
vol_size = str(self.size.get_qty_in('MiB')) + 'M'
|
||||
log_check_call(['/usr/bin/qemu-img', 'create', '-f', 'raw', self.image_path, vol_size])
|
||||
log_check_call(['qemu-img', 'create', '-f', 'raw', self.image_path, vol_size])
|
||||
|
||||
def _before_attach(self, e):
|
||||
[self.loop_device_path] = log_check_call(['/sbin/losetup', '--show', '--find', self.image_path])
|
||||
[self.loop_device_path] = log_check_call(['losetup', '--show', '--find', self.image_path])
|
||||
self.device_path = self.loop_device_path
|
||||
|
||||
def _before_detach(self, e):
|
||||
log_check_call(['/sbin/losetup', '--detach', self.loop_device_path])
|
||||
log_check_call(['losetup', '--detach', self.loop_device_path])
|
||||
del self.loop_device_path
|
||||
del self.device_path
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ class QEMUVolume(LoopbackVolume):
|
|||
def _before_create(self, e):
|
||||
self.image_path = e.image_path
|
||||
vol_size = str(self.size.get_qty_in('MiB')) + 'M'
|
||||
log_check_call(['/usr/bin/qemu-img', 'create', '-f', self.qemu_format, self.image_path, vol_size])
|
||||
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
|
||||
|
@ -40,11 +40,11 @@ class QEMUVolume(LoopbackVolume):
|
|||
def _before_attach(self, e):
|
||||
self._check_nbd_module()
|
||||
self.loop_device_path = self._find_free_nbd_device()
|
||||
log_check_call(['/usr/bin/qemu-nbd', '--connect', self.loop_device_path, self.image_path])
|
||||
log_check_call(['qemu-nbd', '--connect', self.loop_device_path, self.image_path])
|
||||
self.device_path = self.loop_device_path
|
||||
|
||||
def _before_detach(self, e):
|
||||
log_check_call(['/usr/bin/qemu-nbd', '--disconnect', self.loop_device_path])
|
||||
log_check_call(['qemu-nbd', '--disconnect', self.loop_device_path])
|
||||
del self.loop_device_path
|
||||
del self.device_path
|
||||
|
||||
|
|
|
@ -87,8 +87,8 @@ class AptUpdate(Task):
|
|||
|
||||
@classmethod
|
||||
def run(cls, info):
|
||||
log_check_call(['/usr/sbin/chroot', info.root,
|
||||
'/usr/bin/apt-get', 'update'])
|
||||
log_check_call(['chroot', info.root,
|
||||
'apt-get', 'update'])
|
||||
|
||||
|
||||
class AptUpgrade(Task):
|
||||
|
@ -100,15 +100,15 @@ class AptUpgrade(Task):
|
|||
def run(cls, info):
|
||||
from subprocess import CalledProcessError
|
||||
try:
|
||||
log_check_call(['/usr/sbin/chroot', info.root,
|
||||
'/usr/bin/apt-get', 'install',
|
||||
'--fix-broken',
|
||||
'--no-install-recommends',
|
||||
'--assume-yes'])
|
||||
log_check_call(['/usr/sbin/chroot', info.root,
|
||||
'/usr/bin/apt-get', 'upgrade',
|
||||
'--no-install-recommends',
|
||||
'--assume-yes'])
|
||||
log_check_call(['chroot', info.root,
|
||||
'apt-get', 'install',
|
||||
'--fix-broken',
|
||||
'--no-install-recommends',
|
||||
'--assume-yes'])
|
||||
log_check_call(['chroot', info.root,
|
||||
'apt-get', 'upgrade',
|
||||
'--no-install-recommends',
|
||||
'--assume-yes'])
|
||||
except CalledProcessError as e:
|
||||
if e.returncode == 100:
|
||||
import logging
|
||||
|
@ -125,9 +125,9 @@ class PurgeUnusedPackages(Task):
|
|||
|
||||
@classmethod
|
||||
def run(cls, info):
|
||||
log_check_call(['/usr/sbin/chroot', info.root,
|
||||
'/usr/bin/apt-get', 'autoremove',
|
||||
'--purge'])
|
||||
log_check_call(['chroot', info.root,
|
||||
'apt-get', 'autoremove',
|
||||
'--purge'])
|
||||
|
||||
|
||||
class AptClean(Task):
|
||||
|
@ -136,8 +136,8 @@ class AptClean(Task):
|
|||
|
||||
@classmethod
|
||||
def run(cls, info):
|
||||
log_check_call(['/usr/sbin/chroot', info.root,
|
||||
'/usr/bin/apt-get', 'clean'])
|
||||
log_check_call(['chroot', info.root,
|
||||
'apt-get', 'clean'])
|
||||
|
||||
lists = os.path.join(info.root, 'var/lib/apt/lists')
|
||||
for list_file in [os.path.join(lists, f) for f in os.listdir(lists)]:
|
||||
|
|
|
@ -91,9 +91,9 @@ class InstallGrub(Task):
|
|||
idx=idx + 1))
|
||||
|
||||
# Install grub
|
||||
log_check_call(['/usr/sbin/chroot', info.root,
|
||||
'/usr/sbin/grub-install', device_path])
|
||||
log_check_call(['/usr/sbin/chroot', info.root, '/usr/sbin/update-grub'])
|
||||
log_check_call(['chroot', info.root,
|
||||
'grub-install', device_path])
|
||||
log_check_call(['chroot', info.root, 'update-grub'])
|
||||
except Exception as e:
|
||||
if isinstance(info.volume, LoopbackVolume):
|
||||
remount(info.volume, unlink_fn)
|
||||
|
@ -127,12 +127,12 @@ class InstallExtLinux(Task):
|
|||
bootloader = '/usr/lib/syslinux/gptmbr.bin'
|
||||
else:
|
||||
bootloader = '/usr/lib/extlinux/mbr.bin'
|
||||
log_check_call(['/usr/sbin/chroot', info.root,
|
||||
'/bin/dd', 'bs=440', 'count=1',
|
||||
log_check_call(['chroot', info.root,
|
||||
'dd', 'bs=440', 'count=1',
|
||||
'if=' + bootloader,
|
||||
'of=' + info.volume.device_path])
|
||||
log_check_call(['/usr/sbin/chroot', info.root,
|
||||
'/usr/bin/extlinux',
|
||||
log_check_call(['chroot', info.root,
|
||||
'extlinux',
|
||||
'--install', '/boot/extlinux'])
|
||||
log_check_call(['/usr/sbin/chroot', info.root,
|
||||
'/usr/sbin/extlinux-update'])
|
||||
log_check_call(['chroot', info.root,
|
||||
'extlinux-update'])
|
||||
|
|
|
@ -17,7 +17,7 @@ class AddRequiredCommands(Task):
|
|||
|
||||
|
||||
def get_bootstrap_args(info):
|
||||
executable = ['/usr/sbin/debootstrap']
|
||||
executable = ['debootstrap']
|
||||
options = ['--arch=' + info.manifest.system['architecture']]
|
||||
if len(info.include_packages) > 0:
|
||||
options.append('--include=' + ','.join(info.include_packages))
|
||||
|
|
|
@ -29,7 +29,7 @@ class ShredHostkeys(Task):
|
|||
public = [path + '.pub' for path in private]
|
||||
|
||||
from common.tools import log_check_call
|
||||
log_check_call(['/usr/bin/shred', '--remove'] + private + public)
|
||||
log_check_call(['shred', '--remove'] + private + public)
|
||||
|
||||
|
||||
class CleanTMP(Task):
|
||||
|
|
|
@ -43,7 +43,7 @@ class TuneVolumeFS(Task):
|
|||
for partition in info.volume.partition_map.partitions:
|
||||
if not isinstance(partition, UnformattedPartition):
|
||||
if re.match('^ext[2-4]$', partition.filesystem) is not None:
|
||||
log_check_call(['/sbin/tune2fs', '-i', '0', partition.device_path])
|
||||
log_check_call(['tune2fs', '-i', '0', partition.device_path])
|
||||
|
||||
|
||||
class AddXFSProgs(Task):
|
||||
|
|
|
@ -21,10 +21,10 @@ class InstallInitScripts(Task):
|
|||
dst = os.path.join(info.root, 'etc/init.d', name)
|
||||
copy(src, dst)
|
||||
os.chmod(dst, rwxr_xr_x)
|
||||
log_check_call(['/usr/sbin/chroot', info.root, '/sbin/insserv', '--default', name])
|
||||
log_check_call(['chroot', info.root, 'insserv', '--default', name])
|
||||
|
||||
for name in info.initd['disable']:
|
||||
log_check_call(['/usr/sbin/chroot', info.root, '/sbin/insserv', '--remove', name])
|
||||
log_check_call(['chroot', info.root, 'insserv', '--remove', name])
|
||||
|
||||
|
||||
class AddExpandRoot(Task):
|
||||
|
@ -49,8 +49,8 @@ class AddSSHKeyGeneration(Task):
|
|||
install = info.initd['install']
|
||||
from subprocess import CalledProcessError
|
||||
try:
|
||||
log_check_call(['/usr/sbin/chroot', info.root,
|
||||
'/usr/bin/dpkg-query', '-W', 'openssh-server'])
|
||||
log_check_call(['chroot', info.root,
|
||||
'dpkg-query', '-W', 'openssh-server'])
|
||||
if info.manifest.system['release'] == 'squeeze':
|
||||
install['generate-ssh-hostkeys'] = os.path.join(init_scripts_dir, 'squeeze/generate-ssh-hostkeys')
|
||||
else:
|
||||
|
|
|
@ -28,12 +28,12 @@ class GenerateLocale(Task):
|
|||
search = '# ' + locale_str
|
||||
sed_i(locale_gen, search, locale_str)
|
||||
|
||||
log_check_call(['/usr/sbin/chroot', info.root, '/usr/sbin/locale-gen'])
|
||||
log_check_call(['chroot', info.root, 'locale-gen'])
|
||||
|
||||
lang = '{locale}.{charmap}'.format(locale=info.manifest.system['locale'],
|
||||
charmap=info.manifest.system['charmap'])
|
||||
log_check_call(['/usr/sbin/chroot', info.root,
|
||||
'/usr/sbin/update-locale', 'LANG=' + lang])
|
||||
log_check_call(['chroot', info.root,
|
||||
'update-locale', 'LANG=' + lang])
|
||||
|
||||
|
||||
class SetTimezone(Task):
|
||||
|
|
|
@ -45,10 +45,10 @@ class InstallPackages(Task):
|
|||
try:
|
||||
env = os.environ.copy()
|
||||
env['DEBIAN_FRONTEND'] = 'noninteractive'
|
||||
log_check_call(['/usr/sbin/chroot', info.root,
|
||||
'/usr/bin/apt-get', 'install',
|
||||
'--no-install-recommends',
|
||||
'--assume-yes']
|
||||
log_check_call(['chroot', info.root,
|
||||
'apt-get', 'install',
|
||||
'--no-install-recommends',
|
||||
'--assume-yes']
|
||||
+ map(str, remote_packages),
|
||||
env=env)
|
||||
except CalledProcessError as e:
|
||||
|
@ -90,8 +90,8 @@ class InstallPackages(Task):
|
|||
|
||||
env = os.environ.copy()
|
||||
env['DEBIAN_FRONTEND'] = 'noninteractive'
|
||||
log_check_call(['/usr/sbin/chroot', info.root,
|
||||
'/usr/bin/dpkg', '--install']
|
||||
log_check_call(['chroot', info.root,
|
||||
'dpkg', '--install']
|
||||
+ chrooted_package_paths,
|
||||
env=env)
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ class EnableShadowConfig(Task):
|
|||
@classmethod
|
||||
def run(cls, info):
|
||||
from common.tools import log_check_call
|
||||
log_check_call(['/usr/sbin/chroot', info.root, '/sbin/shadowconfig', 'on'])
|
||||
log_check_call(['chroot', info.root, 'shadowconfig', 'on'])
|
||||
|
||||
|
||||
class DisableSSHPasswordAuthentication(Task):
|
||||
|
|
|
@ -22,8 +22,8 @@ class CreateAdminUser(Task):
|
|||
@classmethod
|
||||
def run(cls, info):
|
||||
from common.tools import log_check_call
|
||||
log_check_call(['/usr/sbin/chroot', info.root,
|
||||
'/usr/sbin/useradd',
|
||||
log_check_call(['chroot', info.root,
|
||||
'useradd',
|
||||
'--create-home', '--shell', '/bin/bash',
|
||||
info.manifest.plugins['admin_user']['username']])
|
||||
|
||||
|
@ -65,8 +65,8 @@ class DisableRootLogin(Task):
|
|||
from subprocess import CalledProcessError
|
||||
from common.tools import log_check_call
|
||||
try:
|
||||
log_check_call(['/usr/sbin/chroot', info.root,
|
||||
'/usr/bin/dpkg-query', '-W', 'openssh-server'])
|
||||
log_check_call(['chroot', info.root,
|
||||
'dpkg-query', '-W', 'openssh-server'])
|
||||
from common.tools import sed_i
|
||||
sshdconfig_path = os.path.join(info.root, 'etc/ssh/sshd_config')
|
||||
sed_i(sshdconfig_path, 'PermitRootLogin yes', 'PermitRootLogin no')
|
||||
|
|
|
@ -68,7 +68,7 @@ class SetMetadataSource(Task):
|
|||
logging.getLogger(__name__).warn(msg)
|
||||
return
|
||||
sources = "cloud-init cloud-init/datasources multiselect " + sources
|
||||
log_check_call(['/usr/sbin/chroot', info.root, '/usr/bin/debconf-set-selections'], sources)
|
||||
log_check_call(['chroot', info.root, 'debconf-set-selections'], sources)
|
||||
|
||||
|
||||
class DisableModules(Task):
|
||||
|
|
|
@ -27,7 +27,7 @@ class OpenNebulaContext(Task):
|
|||
sed_i(vmcontext_def, '# Default-Start:', '# Default-Start: 2 3 4 5')
|
||||
|
||||
from common.tools import log_check_call
|
||||
log_check_call(['/usr/sbin/chroot', info.root, 'update-rc.d', 'vmcontext', 'start',
|
||||
log_check_call(['chroot', info.root, 'update-rc.d', 'vmcontext', 'start',
|
||||
'90', '2', '3', '4', '5', 'stop', '90', '0', '6'])
|
||||
|
||||
from shutil import copy
|
||||
|
|
|
@ -84,8 +84,8 @@ class ApplyPuppetManifest(Task):
|
|||
|
||||
manifest_path = os.path.join('/', manifest_rel_dst)
|
||||
from common.tools import log_check_call
|
||||
log_check_call(['/usr/sbin/chroot', info.root,
|
||||
'/usr/bin/puppet', 'apply', manifest_path])
|
||||
log_check_call(['chroot', info.root,
|
||||
'puppet', 'apply', manifest_path])
|
||||
os.remove(manifest_dst)
|
||||
|
||||
from common.tools import sed_i
|
||||
|
|
|
@ -9,5 +9,5 @@ class SetRootPassword(Task):
|
|||
@classmethod
|
||||
def run(cls, info):
|
||||
from common.tools import log_check_call
|
||||
log_check_call(['/usr/sbin/chroot', info.root, '/usr/sbin/chpasswd'],
|
||||
log_check_call(['chroot', info.root, 'chpasswd'],
|
||||
'root:' + info.manifest.plugins['root_password']['password'])
|
||||
|
|
|
@ -71,8 +71,8 @@ class CreateVagrantUser(Task):
|
|||
@classmethod
|
||||
def run(cls, info):
|
||||
from common.tools import log_check_call
|
||||
log_check_call(['/usr/sbin/chroot', info.root,
|
||||
'/usr/sbin/useradd',
|
||||
log_check_call(['chroot', info.root,
|
||||
'useradd',
|
||||
'--create-home', '--shell', '/bin/bash',
|
||||
'vagrant'])
|
||||
|
||||
|
@ -115,8 +115,8 @@ class AddInsecurePublicKey(Task):
|
|||
|
||||
# We can't do this directly with python, since getpwnam gets its info from the host
|
||||
from common.tools import log_check_call
|
||||
log_check_call(['/usr/sbin/chroot', info.root,
|
||||
'/bin/chown', 'vagrant:vagrant',
|
||||
log_check_call(['chroot', info.root,
|
||||
'chown', 'vagrant:vagrant',
|
||||
'/home/vagrant/.ssh', '/home/vagrant/.ssh/authorized_keys'])
|
||||
|
||||
|
||||
|
@ -127,7 +127,7 @@ class SetRootPassword(Task):
|
|||
@classmethod
|
||||
def run(cls, info):
|
||||
from common.tools import log_check_call
|
||||
log_check_call(['/usr/sbin/chroot', info.root, '/usr/sbin/chpasswd'], 'root:vagrant')
|
||||
log_check_call(['chroot', info.root, 'chpasswd'], 'root:vagrant')
|
||||
|
||||
|
||||
class PackageBox(Task):
|
||||
|
|
|
@ -39,7 +39,7 @@ class BundleImage(Task):
|
|||
bundle_name = 'bundle-{id}'.format(id=info.run_id)
|
||||
info.bundle_path = os.path.join(info.workspace, bundle_name)
|
||||
arch = {'i386': 'i386', 'amd64': 'x86_64'}.get(info.manifest.system['architecture'])
|
||||
log_check_call(['/usr/bin/euca-bundle-image',
|
||||
log_check_call(['euca-bundle-image',
|
||||
'--image', info.volume.image_path,
|
||||
'--arch', arch,
|
||||
'--user', info.credentials['user-id'],
|
||||
|
@ -65,7 +65,7 @@ class UploadImage(Task):
|
|||
else:
|
||||
s3_url = 'https://s3-{region}.amazonaws.com/'.format(region=info.host['region'])
|
||||
info.manifest.manifest_location = info.manifest.image['bucket'] + '/' + info.ami_name + '.manifest.xml'
|
||||
log_check_call(['/usr/bin/euca-upload-bundle',
|
||||
log_check_call(['euca-upload-bundle',
|
||||
'--bucket', info.manifest.image['bucket'],
|
||||
'--manifest', manifest_file,
|
||||
'--access-key', info.credentials['access-key'],
|
||||
|
|
|
@ -45,6 +45,6 @@ class ConfigurePVGrub(Task):
|
|||
'GRUB_HIDDEN_TIMEOUT=true')
|
||||
|
||||
from common.tools import log_check_call
|
||||
log_check_call(['/usr/sbin/chroot', info.root, '/usr/sbin/update-grub'])
|
||||
log_check_call(['/usr/sbin/chroot', info.root,
|
||||
'/bin/ln', '--symbolic', '/boot/grub/grub.cfg', '/boot/grub/menu.lst'])
|
||||
log_check_call(['chroot', info.root, 'update-grub'])
|
||||
log_check_call(['chroot', info.root,
|
||||
'ln', '--symbolic', '/boot/grub/grub.cfg', '/boot/grub/menu.lst'])
|
||||
|
|
|
@ -40,17 +40,17 @@ class InstallEnhancedNetworking(Task):
|
|||
urllib.urlretrieve(drivers_url, archive)
|
||||
|
||||
from common.tools import log_check_call
|
||||
log_check_call('/bin/tar', '--ungzip',
|
||||
'--extract',
|
||||
'--file', archive,
|
||||
'--directory', os.path.join(info.root, 'tmp'))
|
||||
log_check_call('tar', '--ungzip',
|
||||
'--extract',
|
||||
'--file', archive,
|
||||
'--directory', os.path.join(info.root, 'tmp'))
|
||||
|
||||
src_dir = os.path.join('/tmp', os.path.basename(drivers_url), 'src')
|
||||
log_check_call(['/usr/sbin/chroot', info.root,
|
||||
'/usr/bin/make', '--directory', src_dir])
|
||||
log_check_call(['/usr/sbin/chroot', info.root,
|
||||
'/usr/bin/make', 'install',
|
||||
'--directory', src_dir])
|
||||
log_check_call(['chroot', info.root,
|
||||
'make', '--directory', src_dir])
|
||||
log_check_call(['chroot', info.root,
|
||||
'make', 'install',
|
||||
'--directory', src_dir])
|
||||
|
||||
ixgbevf_conf_path = os.path.join(info.root, 'etc/modprobe.d/ixgbevf.conf')
|
||||
with open(ixgbevf_conf_path, 'w') as ixgbevf_conf:
|
||||
|
|
|
@ -29,8 +29,8 @@ class AddGuestAdditionsPackages(Task):
|
|||
info.packages.add('dkms')
|
||||
|
||||
from common.tools import log_check_call
|
||||
[kernel_version] = log_check_call(['/usr/sbin/chroot', info.root,
|
||||
'/bin/uname', '-r'])
|
||||
[kernel_version] = log_check_call(['chroot', info.root,
|
||||
'uname', '-r'])
|
||||
kernel_headers_pkg = 'linux-headers-{version}'.format(version=kernel_version)
|
||||
info.packages.add(kernel_headers_pkg)
|
||||
|
||||
|
@ -52,7 +52,7 @@ class InstallGuestAdditions(Task):
|
|||
|
||||
install_script = os.path.join('/', mount_dir, 'VBoxLinuxAdditions.run')
|
||||
from common.tools import log_call
|
||||
status, out, err = log_call(['/usr/sbin/chroot', info.root,
|
||||
status, out, err = log_call(['chroot', info.root,
|
||||
install_script, '--nox11'])
|
||||
# Install will exit with $?=1 because X11 isn't installed
|
||||
if status != 1:
|
||||
|
|
Loading…
Add table
Reference in a new issue