diff options
Diffstat (limited to 'morphlib/writeexts.py')
-rw-r--r-- | morphlib/writeexts.py | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/morphlib/writeexts.py b/morphlib/writeexts.py index 1849f406..3f9c33d5 100644 --- a/morphlib/writeexts.py +++ b/morphlib/writeexts.py @@ -15,6 +15,7 @@ import cliapp +import logging import os import re import shutil @@ -333,11 +334,15 @@ class WriteExtension(cliapp.Application): cliapp.runcmd(['cp', '-a', try_path, kernel_dest]) break + def get_extra_kernel_args(self): + return os.environ.get('KERNEL_ARGS', '') + def install_extlinux(self, real_root): '''Install extlinux on the newly created disk image.''' self.status(msg='Creating extlinux.conf') config = os.path.join(real_root, 'extlinux.conf') + kernel_args = self.get_extra_kernel_args() with open(config, 'w') as f: f.write('default linux\n') f.write('timeout 1\n') @@ -345,7 +350,7 @@ class WriteExtension(cliapp.Application): f.write('kernel /systems/default/kernel\n') f.write('append root=/dev/sda ' 'rootflags=subvol=systems/default/run ' - 'init=/sbin/init rw\n') + '%s init=/sbin/init rw\n' % (kernel_args)) self.status(msg='Installing extlinux') cliapp.runcmd(['extlinux', '--install', real_root]) @@ -413,3 +418,11 @@ class WriteExtension(cliapp.Application): else: raise cliapp.AppException('Unexpected value for %s: %s' % (variable, value)) + + def check_ssh_connectivity(self, ssh_host): + try: + cliapp.ssh_runcmd(ssh_host, ['true']) + except cliapp.AppException as e: + logging.error("Error checking SSH connectivity: %s", str(e)) + raise cliapp.AppException( + 'Unable to SSH to %s: %s' % (ssh_host, e)) |