summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam Thursfield <sam.thursfield@codethink.co.uk>2016-03-07 16:32:24 +0000
committerSam Thursfield <sam.thursfield@codethink.co.uk>2016-03-07 16:45:23 +0000
commit75cbcbe0ab505b13efefbf93dbc1f6f57f24c427 (patch)
tree1135e2b4b5d14744172cdb76782b1ff55cc1eeea
parentf7f583f0c5ed026086a71d603b5e208364db03e5 (diff)
downloaddefinitions-75cbcbe0ab505b13efefbf93dbc1f6f57f24c427.tar.gz
cloud-init.configure: Fix use of MORPH_LOG_FD
MORPH_LOG_FD exists so that deployment extensions can write detailed log info to a file. This extension doesn't output much detailed log info, but some of the Python ones do & it's really useful for debugging. With Morph, this extension seems to have been writing logs to a file named '3' rather than to the actual deployment log. With YBD, this extension crashed because MORPH_LOG_FD was unset. Extra logs will now go to stdout when deploying with YBD. Change-Id: I46ead092d0e071970e355c8539823836f28dd97b
-rwxr-xr-xextensions/cloud-init.configure8
1 files changed, 7 insertions, 1 deletions
diff --git a/extensions/cloud-init.configure b/extensions/cloud-init.configure
index aa83e0e2..3bcc0909 100755
--- a/extensions/cloud-init.configure
+++ b/extensions/cloud-init.configure
@@ -22,6 +22,12 @@ set -e
ROOT="$1"
+# Write detailed logs to a special log file if set, otherwise everything
+# goes to stdout.
+if [ -z "$MORPH_LOG_FD" ]; then
+ MORPH_LOG_FD=1
+fi
+
##########################################################################
set -e
@@ -56,7 +62,7 @@ for service_name in $cloud_init_services; do
echo "Failed to configure cloud-init."
exit 1
else
- echo Enabling systemd service "$service_name" >"$MORPH_LOG_FD"
+ echo Enabling systemd service "$service_name" >&"$MORPH_LOG_FD"
ln -sf "/$services_folder/$service_name" \
"$ROOT/etc/systemd/system/multi-user.target.wants/$service_name"
fi