Wizard: Remove first boot script from services when no script

There is a bug that makes `custom-first-boot` service stay in services when the first boot script is removed.

How to reproduce:
1. create a blueprint with a first boot script
2. download the blueprint and confirm `custom-first-boot` was added to enabled services
3. click on "Edit blueprint"
4. go to First boot step and remove the script
5. save edited blueprint

Current behaviour:
- `custom-first-boot` service should be still enabled even with the removed first boot script

Updated behaviour:
- `custom-first-boot` is no longer in the blueprint after first boot script got removed
This commit is contained in:
regexowl 2025-02-10 14:23:33 +01:00 committed by Klara Simickova
parent 26f56bf9f0
commit 59e383fe5a
2 changed files with 32 additions and 0 deletions

View file

@ -565,6 +565,13 @@ const getServices = (state: RootState): Services | undefined => {
if (includeFBSvc) {
enabledSvcs = [...enabledSvcs, FIRST_BOOT_SERVICE];
}
if (
(!selectFirstBootScript(state) ||
selectFirstBootScript(state).length === 0) &&
enabledSvcs.includes(FIRST_BOOT_SERVICE)
) {
enabledSvcs = enabledSvcs.filter((s) => s !== FIRST_BOOT_SERVICE);
}
if (
enabledSvcs.length === 0 &&
services.masked.length === 0 &&