summaryrefslogtreecommitdiff
path: root/vmdebootstrap/base.py
diff options
context:
space:
mode:
authorNeil Williams <codehelp@debian.org>2015-09-13 13:41:34 +0100
committerNeil Williams <codehelp@debian.org>2015-09-13 13:41:34 +0100
commitef46ac405997c234c4ba4c1d1f810c050ea09378 (patch)
treeb46f796389fe5c4bd97f4dce3d26713c1eb89832 /vmdebootstrap/base.py
parent5ec18fb16910eae21a793629579a284021242f32 (diff)
downloadvmdebootstrap-ef46ac405997c234c4ba4c1d1f810c050ea09378.tar.gz
reinstate headless support from master
Diffstat (limited to 'vmdebootstrap/base.py')
-rw-r--r--vmdebootstrap/base.py12
1 files changed, 5 insertions, 7 deletions
diff --git a/vmdebootstrap/base.py b/vmdebootstrap/base.py
index fc7305d..df21a23 100644
--- a/vmdebootstrap/base.py
+++ b/vmdebootstrap/base.py
@@ -148,14 +148,12 @@ class Base(object):
logging.debug(
"%s usage: %s", self.settings['image'],
runcmd(['du', self.settings['image']]))
- with open('/dev/tty', 'w') as tty:
- try:
+ try:
+ with open('/dev/tty', 'w') as tty:
cliapp.runcmd([script, rootdir, self.settings['image']], stdout=tty, stderr=tty)
- except IOError:
- subprocess.call([script, rootdir, self.settings['image']])
- logging.debug(
- "%s usage: %s", self.settings['image'],
- runcmd(['du', self.settings['image']]))
+ except IOError:
+ logging.debug('tty unavailable, trying in headless mode.')
+ subprocess.call([script, rootdir, self.settings['image']])
def append_serial_console(self, rootdir):
if self.settings['serial-console']: