From bad945f5d7004a89ceb814bacf2e92a8e0b62e91 Mon Sep 17 00:00:00 2001 From: Carlos Nihelton Date: Tue, 14 Dec 2021 12:04:38 -0300 Subject: [PATCH] Remove username from wsl.conf - This is a cleanup for SystemSetup per DEENG-134 and DEENG-139 - Default user should be set by the WSL launcher. - Shutdown/reboot actions also. - Added a structured form of communication between OOBE and launcher. - /run/launcher-command --- scripts/runtests.sh | 25 +++++++++++++------ system_setup/tests/golden/answers/wsl.conf | 4 --- .../tests/golden/autoinstall-full/wsl.conf | 4 --- .../tests/golden/autoinstall/wsl.conf | 4 --- 4 files changed, 18 insertions(+), 19 deletions(-) diff --git a/scripts/runtests.sh b/scripts/runtests.sh index 1bafbd00..ea119913 100755 --- a/scripts/runtests.sh +++ b/scripts/runtests.sh @@ -28,19 +28,30 @@ validate () { netplan generate --root .subiquity elif [ "${mode}" = "system_setup" ]; then setup_mode="$2" + launcher_cmds=".subiquity/run/launcher-command" echo "system setup validation for $setup_mode" - echo "checking launcher-status" - [ -d ".subiquity/run/subiquity/" ] || (echo "run/subiquity/ dir not created for status"; exit 1) - [ -e ".subiquity/run/subiquity/launcher-status" ] || (echo "run/subiquity/launcher-status not created"; exit 1) + echo "checking ${launcher_cmds}" + if [ ! -f ${launcher_cmds} ]; then + echo "Expected launcher commands to be written to the file." + exit 1 + elif [ -z "$(grep action ${launcher_cmds})" ] && [ "${setup_mode}" != "autoinstall-no-shutdown" ]; then + echo "Expected action to be set in launcher commands." + exit 1 + elif [ -z "$(grep defaultUid ${launcher_cmds})" ] && [ "${setup_mode}" != "answers-reconf" ]; then + echo "Expected defaultUid to be set in launcher commands." + exit 1 + else + cat ${launcher_cmds} + fi expected_status="reboot" if [ "${setup_mode}" = "autoinstall-full" ]; then expected_status="shutdown" elif [ "${setup_mode}" = "autoinstall-no-shutdown" ]; then - expected_status="complete" + expected_status="" fi - result_status="$(cat .subiquity/run/subiquity/launcher-status)" + result_status="$(cat ${launcher_cmds} | grep action | cut -d = -f 2)" if [ "${result_status}" != "${expected_status}" ]; then - echo "incorrect run/subiquity/launcher-status: expect ${expected_status}, got ${result_status}" + echo "incorrect ${launcher_cmds}: expect ${expected_status}, got ${result_status}" exit 1 fi echo "checking generated config" @@ -52,7 +63,7 @@ validate () { for file in system_setup/tests/golden/${setup_mode}/*.conf; do filename=$(basename ${file}) conf_filepath=".subiquity/etc/${filename}" - diff -Nup "${file}" "${conf_filepath}" || exit 1 + diff -NBup "${file}" "${conf_filepath}" || exit 1 done if [ "${setup_mode}" != "answers-reconf" ]; then echo "checking user created" diff --git a/system_setup/tests/golden/answers/wsl.conf b/system_setup/tests/golden/answers/wsl.conf index 442a8b52..a110cfe1 100644 --- a/system_setup/tests/golden/answers/wsl.conf +++ b/system_setup/tests/golden/answers/wsl.conf @@ -5,7 +5,3 @@ root = /custom_mnt_path [network] generatehosts = false generateresolvconf = false - -[user] -default = ubuntu - diff --git a/system_setup/tests/golden/autoinstall-full/wsl.conf b/system_setup/tests/golden/autoinstall-full/wsl.conf index 39ef73cf..22dce10d 100644 --- a/system_setup/tests/golden/autoinstall-full/wsl.conf +++ b/system_setup/tests/golden/autoinstall-full/wsl.conf @@ -11,7 +11,3 @@ enabled = false [network] generatehosts = false generateresolvconf = false - -[user] -default = ubuntu - diff --git a/system_setup/tests/golden/autoinstall/wsl.conf b/system_setup/tests/golden/autoinstall/wsl.conf index 442a8b52..a110cfe1 100644 --- a/system_setup/tests/golden/autoinstall/wsl.conf +++ b/system_setup/tests/golden/autoinstall/wsl.conf @@ -5,7 +5,3 @@ root = /custom_mnt_path [network] generatehosts = false generateresolvconf = false - -[user] -default = ubuntu -