Public bug reported:

Currently any invocation of curtin that incurs an exception during the
'install' phase will trigger a path which runs the error log collection

THere's a bug there which runs sys.exit() in the non-main body of the
code;  Instead only subcommands _main_ methods should use sys.exit();
the collection method (create_log_tarfile) need only return.

 % git diff
diff --git a/curtin/commands/ b/curtin/commands/
index a61d91e..2078f37 100644
--- a/curtin/commands/
+++ b/curtin/commands/
@@ -48,6 +48,7 @@ def collect_logs_main(args):
         cfg = CONFIG_BUILTIN.copy()
     create_log_tarfile(args.output, cfg)
+    sys.exit(0)
 def create_log_tarfile(tarfile, config):
@@ -104,7 +105,7 @@ def create_log_tarfile(tarfile, config):
         if os.path.exists(tmp_dir):
     sys.stderr.write('Wrote: %s\n' % tarfile)
-    sys.exit(0)
+    return

ProblemType: Bug
DistroRelease: Ubuntu 18.04
Package: curtin 17.1-37-g82622f12-0ubuntu1
ProcVersionSignature: Ubuntu 4.13.0-32.35~16.04.1-generic 4.13.13
Uname: Linux 4.13.0-32-generic x86_64
ApportVersion: 2.20.8-0ubuntu10
Architecture: amd64
Date: Fri Feb 23 02:00:28 2018
PackageArchitecture: all
 PATH=(custom, no user)
SourcePackage: curtin
UpgradeStatus: No upgrade log present (probably fresh install)

** Affects: curtin (Ubuntu)
     Importance: Undecided
         Status: New

** Tags: amd64 apport-bug bionic uec-images

You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.

  curtin exit codes broken by collect_logs misuse of sys.exit

To manage notifications about this bug go to:

ubuntu-bugs mailing list

Reply via email to