I’ve spent the last couple of days trying different things and learning more about MAAS to prevent it from shutting down servers.
Here’s the code responsible for shutting down. https://github.com/maas/maas/blob/master/src/maasserver/compose_preseed.py#L529-L556
Line 550 onwards, I want to edit line 553 to mode restart.
I had the idea of making my own custom preseed file (curtin_userdata) as all the others are just “{{preseed_data}}” from this MAAS logic. But, unfortunately, this file is only loaded while a server is deploying and not in any other state. Otherwise, I would have added a touch command to make a file that the shutdown logic tests always.
I cannot just modify this file as MAAS is built, then shipped as a Snap, so I was wondering if a feature could be added that will allow my use case/fix this issue:
I had in mind that MAAS has a setting per controller that allows adjusting this to change the default behaviour from poweroff to reboot and apply this to specific power action types? So, for example, it could be set where servers with the power type as manual or webhook will reboot and never shut down, but MAAS can shut down servers with IPMI.