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
code.

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/collect_logs.py b/curtin/commands/collect_logs.py
index a61d91e..2078f37 100644
--- a/curtin/commands/collect_logs.py
+++ b/curtin/commands/collect_logs.py
@@ -48,6 +48,7 @@ def collect_logs_main(args):
                 SAVE_INSTALL_CONFIG, CURTIN_PACK_CONFIG_DIR))
         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):
             shutil.rmtree(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
ProcEnviron:
 TERM=xterm-256color
 PATH=(custom, no user)
 LANG=C.UTF-8
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.
https://bugs.launchpad.net/bugs/1751176

Title:
  curtin exit codes broken by collect_logs misuse of sys.exit

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/curtin/+bug/1751176/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to