Package: vmdebootstrap
Version: 1.7-1
Severity: normal
Tags: patch

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

When running under a tty, vmdebootstrap fails when the customization script
fails and this is as expected. However, when not running under a tty (such as
when triggered by a CI server) vmdebootstrap does not fail when customization
script fails. This is a simple error in the way customization script is invoked
within vmdebootstrap and the attached patch fixes it.

PS: I know that we are supposed to be using vmdb2 instead but we have not
migrated yet as that needs quite some effort for us.



- -- System Information:
Debian Release: 9.3
  APT prefers stable
  APT policy: (500, 'stable')
Architecture: amd64 (x86_64)

Kernel: Linux 4.9.0-5-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_IN.UTF-8, LC_CTYPE=en_IN.UTF-8 (charmap=UTF-8), 
LANGUAGE=en_IN.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages vmdebootstrap depends on:
ii  debootstrap         1.0.89
ii  kpartx              0.6.4-5
ii  libjs-sphinxdoc     1.4.9-2
ii  parted              3.2-17
ii  python              2.7.13-2
ii  python-cliapp       1.20160724-2
ii  python-distro-info  0.14
ii  python2.7           2.7.13-2+deb9u2
ii  qemu-utils          1:2.8+dfsg-6+deb9u3

Versions of packages vmdebootstrap recommends:
ii  dosfstools        4.1-1
ii  extlinux          3:6.03+dfsg-14.1+deb9u1
ii  grub2-common      2.02~beta3-5
pn  python-guestfs    <none>
ii  qemu-system       1:2.8+dfsg-6+deb9u3
ii  qemu-user-static  1:2.8+dfsg-6+deb9u3
ii  squashfs-tools    1:4.3-3+deb9u1

Versions of packages vmdebootstrap suggests:
pn  cmdtest  <none>
pn  mbr      <none>
ii  pandoc   1.17.2~dfsg-3
pn  u-boot   <none>

- -- no debconf information

-----BEGIN PGP SIGNATURE-----

iQJFBAEBCgAvFiEE5xPDY9ZyWnWupXSBQ+oc/wqnxfIFAlp9icQRHHN1bmlsQG1l
ZGhhcy5vcmcACgkQQ+oc/wqnxfIu9Q/+JIAzqLn6ZHibjFc9QVw+yIu9ylkVuntY
bGQHyCd538O3kajZSTs/Tivge0VKyVREIFI85pCaIuQcBhKl3q/rGU37LYQMVfhB
VOB+bMjLLqCamYmm3GYsBCAIXHXzsz4jJUOhqTC03oMRqVy0TwDeNItu+zrwYS+X
HONqvBakmbj8rUf7aecj+LXgP4nuA52IaRN50ZG/vlWwPP43PgPSD7AIzhFPsTuV
su3kG1q93e4t8TGjzvfc8MkOlF2GLqoeCDQFbD1FC2EZ+paCWAVLQY2Uz3S4+8xi
mZVM/ES6w8WTL17v84vb+q2IYFCXQpwvjxyh36sYSnQ2V6tsRzumG2tYdcvkagrD
Uys+3fkU90Hd/zLNYhluLiDIT0QlA+KfWB3hJ4BE1y0rhmfkXT0vRQVqlGU9oiBW
ioVsvqYfZJF1c+Gny/ld/K1XsI7V9eaOy8o1gsk5Qg6tICtiFKUZnj+4xMumuKNx
K6yUcsJW97BZLSNJk0iXbTlbgLt31OcozkW57po+5LNXK9gBCAbbap/d9xI0S7ZC
bf8oFCmkMcihoQEPTuebWkRcilDTiQuCDFOu1C1/qXAuqTOYkCUn8ek7nkcyal8e
J3qMjimvJPAmz44LSGjkm9AGXomGtPoy2+iDyJ9myDnI5PlPVfCN4nvUmK8Htukq
cipBReRpxn0=
=hDZj
-----END PGP SIGNATURE-----
>From 023be40b32d9ab1cee1ea84396c52b4f98022fcc Mon Sep 17 00:00:00 2001
From: Sunil Mohan Adapa <su...@medhas.org>
Date: Fri, 9 Feb 2018 17:00:59 +0530
Subject: [PATCH] Recognize customize script failures without tty

When customization script fails when not running under tty, don't ignore the
error.

Signed-off-by: Sunil Mohan Adapa <su...@medhas.org>
---
 vmdebootstrap/base.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/vmdebootstrap/base.py b/vmdebootstrap/base.py
index d090f0e..3ba58b3 100644
--- a/vmdebootstrap/base.py
+++ b/vmdebootstrap/base.py
@@ -164,7 +164,7 @@ class Base(object):
                 cliapp.runcmd([script, rootdir, self.settings['image']], 
stdout=tty, stderr=tty)
         except IOError:
             logging.debug('tty unavailable, trying in headless mode.')
-            subprocess.call([script, rootdir, self.settings['image']])
+            subprocess.check_call([script, rootdir, self.settings['image']])
 
     def append_serial_console(self, rootdir):
         if self.settings['serial-console']:
-- 
2.11.0

Reply via email to