summaryrefslogtreecommitdiff
path: root/systemd
diff options
context:
space:
mode:
authorJames Falcon <james.falcon@canonical.com>2022-03-23 18:03:00 -0500
committerGitHub <noreply@github.com>2022-03-23 17:03:00 -0600
commiteee603294f120cf98696351433e7e6dbc9a3dbc2 (patch)
tree1c304f19fe9d3a940915c18ff27618d40c6b2ad1 /systemd
parent58fd35b4ccb97a0633c2ed1cf0d5f19879802356 (diff)
downloadcloud-init-git-eee603294f120cf98696351433e7e6dbc9a3dbc2.tar.gz
Fix cloud-init status --wait when no datasource found (#1349)
* Fix cloud-init status --wait when no datasource found In 0de7acb1, we modified status checks to wait until we get an "enabled" or "disabled" file from ds-identiy. ds-identify never outputs a "disabled" file, so "status --wait" will wait indefinitely if no datasource is found. LP: #1966085
Diffstat (limited to 'systemd')
-rw-r--r--systemd/cloud-init-generator.tmpl7
1 files changed, 7 insertions, 0 deletions
diff --git a/systemd/cloud-init-generator.tmpl b/systemd/cloud-init-generator.tmpl
index db964825..6c4a66d1 100644
--- a/systemd/cloud-init-generator.tmpl
+++ b/systemd/cloud-init-generator.tmpl
@@ -9,6 +9,7 @@ LOG_F="/run/cloud-init/cloud-init-generator.log"
ENABLE="enabled"
DISABLE="disabled"
RUN_ENABLED_FILE="$LOG_D/$ENABLE"
+RUN_DISABLED_FILE="$LOG_D/$DISABLE"
CLOUD_TARGET_NAME="cloud-init.target"
# lxc sets 'container', but lets make that explicitly a global
CONTAINER="${container}"
@@ -151,6 +152,10 @@ main() {
"ln $CLOUD_SYSTEM_TARGET $link_path"
fi
fi
+ if [ -e $RUN_DISABLED_FILE ]; then
+ debug 1 "removing $RUN_DISABLED_FILE and creating $RUN_ENABLED_FILE"
+ rm -f $RUN_DISABLED_FILE
+ fi
: > "$RUN_ENABLED_FILE"
elif [ "$result" = "$DISABLE" ]; then
if [ -f "$link_path" ]; then
@@ -164,8 +169,10 @@ main() {
debug 1 "already disabled: no change needed [no $link_path]"
fi
if [ -e "$RUN_ENABLED_FILE" ]; then
+ debug 1 "removing $RUN_ENABLED_FILE and creating $RUN_DISABLED_FILE"
rm -f "$RUN_ENABLED_FILE"
fi
+ : > "$RUN_DISABLED_FILE"
else
debug 0 "unexpected result '$result' 'ds=$ds'"
ret=3