From 3d7833a64041e417724fe6a041e84d06526839d0 Mon Sep 17 00:00:00 2001 From: Paulo Castro Date: Wed, 8 Jul 2020 10:13:22 +0100 Subject: [PATCH] preload: Expand dockerd stderr logs in case of errors Change-type: patch --- patches/balena-preload+9.0.0.patch | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 patches/balena-preload+9.0.0.patch diff --git a/patches/balena-preload+9.0.0.patch b/patches/balena-preload+9.0.0.patch new file mode 100644 index 00000000..ffa84203 --- /dev/null +++ b/patches/balena-preload+9.0.0.patch @@ -0,0 +1,20 @@ +diff --git a/node_modules/balena-preload/src/preload.py b/node_modules/balena-preload/src/preload.py +index 887eaf3..0c5cc7f 100755 +--- a/node_modules/balena-preload/src/preload.py ++++ b/node_modules/balena-preload/src/preload.py +@@ -489,8 +489,13 @@ def start_docker_daemon(storage_driver, docker_dir): + if running_dockerd.process.exit_code is not None: + # There is no reason for dockerd to exit with a 0 status now. + assert running_dockerd.process.exit_code != 0 +- # This will raise an sh.ErrorReturnCode_X exception. +- running_dockerd.wait() ++ try: ++ # This will raise an sh.ErrorReturnCode_X exception. ++ running_dockerd.wait() ++ except: ++ print("An error has occurred executing 'dockerd':\n{}".format( ++ running_dockerd.stderr.decode("utf8")), file=sys.stderr, flush=True) ++ raise + # Check that we can connect to dockerd. + output = docker("version", _ok_code=[0, 1]) + ok = output.exit_code == 0