Open christoph-buente opened 9 months ago
Cloud-init v. 20.4.1 finished at Thu, 21 Dec 2023 22:12:57 +0000. Datasource DataSourceHetzner. Up 117.15 seconds
Ok, I was just too impatient. The script was still running and eventually, the cloud-init finished including the post_script
. But still, as pre_script
, main_part
, and post_script
are executed in the context of one giant shell script which stops due to set -e
at any point when a command fails.
so you are suggesting to disable -e for the before/after scripts?
Well, each script should run with -e
option to stop when something goes wrong. I'm suggesting running the scripts sequentially, but independently from each other.
https://github.com/pellepelster/solidblocks/blob/5444af56915a988fe0d5c4f55c89323f2533ac62/solidblocks-hetzner/modules/rds-postgresql/user_data.sh#L237-L239
Hey, i wanted to execute a restart of a service in the
post_script
part, but i felt it does not get executed. I made a simple test to check:Turns out that the file is never written. I guess some of the commands fail silently due to
set -eu -o pipefail
. Can we make sure thepre_script
andpost_script
commands are executed regardless of the user data script having issues?