diff --git a/examples/autoinstall-system-setup-full.yaml b/examples/autoinstall-system-setup-full.yaml new file mode 100644 index 00000000..7256a515 --- /dev/null +++ b/examples/autoinstall-system-setup-full.yaml @@ -0,0 +1,28 @@ +version: 1 +early-commands: + - echo a + - ["sleep", "1"] + - echo a +locale: en_US +identity: + realname: Ubuntu + username: ubuntu + # ubuntu + password: '$6$wdAcoXrU039hKYPd$508Qvbe7ObUnxoj15DRCkzC3qO7edjH0VV7BPNRDYK4QR8ofJaEEF2heacn0QgD.f8pO8SNp83XNdWG6tocBM1' +wslconfbase: + automount_root: '/custom_mnt_path' + automount_options: 'metadata' + network_generatehosts: false + network_generateresolvconf: false +wslconfadvanced: + interop_enabled: false + interop_appendwindowspath: false + gui_theme: 'light' + gui_followwintheme: true + interop_guiintegration: true + interop_audiointegration: true + interop_advancedipdetection: true + motd_wslnewsenabled: false + automount_enabled: false + automount_mountfstab: false +shutdown: 'reboot' \ No newline at end of file diff --git a/examples/autoinstall-system-setup.yaml b/examples/autoinstall-system-setup.yaml index 7256a515..a3f1db74 100644 --- a/examples/autoinstall-system-setup.yaml +++ b/examples/autoinstall-system-setup.yaml @@ -14,15 +14,4 @@ wslconfbase: automount_options: 'metadata' network_generatehosts: false network_generateresolvconf: false -wslconfadvanced: - interop_enabled: false - interop_appendwindowspath: false - gui_theme: 'light' - gui_followwintheme: true - interop_guiintegration: true - interop_audiointegration: true - interop_advancedipdetection: true - motd_wslnewsenabled: false - automount_enabled: false - automount_mountfstab: false shutdown: 'reboot' \ No newline at end of file diff --git a/scripts/runtests.sh b/scripts/runtests.sh index 9ea2cc51..3497d21b 100755 --- a/scripts/runtests.sh +++ b/scripts/runtests.sh @@ -115,13 +115,14 @@ grep -q 'finish: subiquity/Install/install/postinstall/run_unattended_upgrades: # The OOBE doesn't exist in WSL < 20.04 if [ "${RELEASE%.*}" -ge 20 ]; then - # NOTE: - # This test doesnt do much ATM but it will be useful when we have more complex scenarios to test with the server and client code. - # Like generating a wsl.conf file and comparing it to the oracle. clean timeout --foreground 60 sh -c "LANG=C.UTF-8 python3 -m system_setup.cmd.tui --autoinstall examples/autoinstall-system-setup.yaml --dry-run" validate "system_setup" "autoinstall" + clean + timeout --foreground 60 sh -c "LANG=C.UTF-8 python3 -m system_setup.cmd.tui --autoinstall examples/autoinstall-system-setup-full.yaml --dry-run" + validate "system_setup" "autoinstall-full" + python3 -m system_setup.cmd.schema > "$testschema" scripts/schema-cmp.py "autoinstall-system-setup-schema.json" "$testschema" --ignore-tz fi diff --git a/system_setup/server/controllers/configure.py b/system_setup/server/controllers/configure.py index e6c23fd1..2d1951cc 100644 --- a/system_setup/server/controllers/configure.py +++ b/system_setup/server/controllers/configure.py @@ -99,6 +99,12 @@ class ConfigureController(SubiquityController): wsl_config_update(self.model.wslconfadvanced.wslconfadvanced, root_dir) + # update advanced config when it is in autoinstall mode + if self.app.opts.autoinstall is not None and \ + self.model.wslconfadvanced.wslconfadvanced is not None: + wsl_config_update(self.model.wslconfadvanced.wslconfadvanced, + root_dir) + wsl_config_update(self.model.wslconfbase.wslconfbase, root_dir) self.app.update_state(ApplicationState.DONE) diff --git a/system_setup/tests/golden/autoinstall-full/ubuntu-wsl.conf b/system_setup/tests/golden/autoinstall-full/ubuntu-wsl.conf new file mode 100644 index 00000000..a9de1305 --- /dev/null +++ b/system_setup/tests/golden/autoinstall-full/ubuntu-wsl.conf @@ -0,0 +1,12 @@ +[GUI] +followwintheme = true +theme = light + +[Interop] +advancedipdetection = true +audiointegration = true +guiintegration = true + +[Motd] +wslnewsenabled = false + diff --git a/system_setup/tests/golden/autoinstall-full/wsl.conf b/system_setup/tests/golden/autoinstall-full/wsl.conf new file mode 100644 index 00000000..449819ba --- /dev/null +++ b/system_setup/tests/golden/autoinstall-full/wsl.conf @@ -0,0 +1,14 @@ +[automount] +enabled = false +mountfstab = false +options = metadata +root = /custom_mnt_path + +[interop] +appendwindowspath = false +enabled = false + +[network] +generatehosts = false +generateresolvconf = false +