summaryrefslogtreecommitdiff
path: root/upstart
diff options
context:
space:
mode:
Diffstat (limited to 'upstart')
-rw-r--r--upstart/cloud-config.conf2
-rw-r--r--upstart/cloud-run-user-script.conf24
2 files changed, 19 insertions, 7 deletions
diff --git a/upstart/cloud-config.conf b/upstart/cloud-config.conf
index 6649a99d..5c6fed82 100644
--- a/upstart/cloud-config.conf
+++ b/upstart/cloud-config.conf
@@ -5,4 +5,4 @@ start on (filesystem and started rsyslog)
console output
task
-exec cloud-init-cfg all
+exec cloud-init-cfg all cloud_config
diff --git a/upstart/cloud-run-user-script.conf b/upstart/cloud-run-user-script.conf
index 9a47e57b..e845aa71 100644
--- a/upstart/cloud-run-user-script.conf
+++ b/upstart/cloud-run-user-script.conf
@@ -7,10 +7,22 @@ console output
task
script
-iid=$(cloud-init-query instance-id) || exit 1
-sdir="/var/lib/cloud/data/scripts/${iid}"
-if [ -d "$sdir" ]; then
- exec cloud-init-run-module once-per-instance user-scripts execute \
- run-parts --regex '.*' "$sdir"
-fi
+bd=/var/lib/cloud
+toks="
+ ${bd}/scripts/per-once:once:cloud-scripts-per-once
+ ${bd}/scripts/per-boot:always:cloud-scripts-per-boot
+ ${bd}/scripts/per-instance:once-per-instance:cloud-scripts-per-instance
+ ${bd}/instance/scripts:once-per-instance:user-scripts
+"
+oifs=${IFS}
+errors=""
+for tok in ${toks}; do
+ IFS=":"; set -- ${tok}; IFS=${oifs}
+ dir=${1}; per=${2}; name=${3}
+ [ -d "${dir}" ] || continue
+ cloud-init-run-module "${per}" "${name}" execute \
+ run-parts --regex '.*' "$dir" || errors="${errors} ${name}"
+done
+errors=${errors# }
+[ -z "${errors}" ] || { echo "errors executing ${errors}" 1>&2; exit 1; }
end script