Open petercooperjr opened 1 year ago
I can confirm this behavior. For now, you can work around the problem by adding a condition that evaluates to true, so the following cloud-config will do what you expect:
#cloud-config
power_state:
delay: now
mode: poweroff
condition: /bin/true
Another fail of the power_state
.
power_state:
condition: '! needs-restarting -r'
message: Rebooting for upgrade
mode: reboot
A few years ago this would always reboot the server. But now this does not reboot. Yet I know that condition should trigger, and when I console to the instance and run the condition it returns true.
Related the a needed cloud init module not loaded? https://bugzilla.redhat.com/show_bug.cgi?id=1252477
Describe the bug A directive given in cloud-config user-data to poweroff after cloud-config data runs doesn't seem to do anything in Amazon Linux 2023, though the same user-data works on Amazon Linux 2.
To Reproduce Testing done in the us-east-1 region.
Create a file
power-off.cloud-config
with these contents:Start an instance using that file as user-data:
The instance launches, but does not turn off and terminate on its own as directed.
Expected behavior If doing the same thing with Amazon Linux 2, the instance does shut itself down and terminate after running the cloud-config data:
Additional context Obviously my actual case is a cloud-config with more commands to run on bootup and then having the instance terminate itself after running them; this is just a minimal example to reproduce the problem.
power_state
directive: https://cloudinit.readthedocs.io/en/latest/reference/modules.html#power-state-change