forked from kworkflow/kworkflow
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Completely remove kw vars functionality as this feature has been deprecated by the kw config --show functionality. This commit does the following: * change documentation to recommend kw config --show instead of kw vars * remove kw vars documentation and base code * remove show_variables_main function used internally by kw vars and its tests Closes: kworkflow#1026 Reviewed-by: David Tadokoro <[email protected]> Signed-off-by: Marcelo Mendes Spessoto Junior <[email protected]> Signed-off-by: David Tadokoro <[email protected]>
- Loading branch information
1 parent
d1556d2
commit 9e40555
Showing
11 changed files
with
5 additions
and
249 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -253,112 +253,6 @@ function get_all_assigned_options_to_string_helper() | |
printf '%s' "$output" | ||
} | ||
|
||
function test_show_variables_main_completeness() | ||
{ | ||
local -A shown_options | ||
local -A possible_options | ||
local output | ||
local output_vm | ||
local output_mail | ||
local output_build | ||
local output_deploy | ||
local output_notification | ||
|
||
configurations=() | ||
|
||
# get all assigned options, including commented ones | ||
# remove #'s and ='s to get option names | ||
output=$(get_all_assigned_options_to_string_helper "$KW_CONFIG_TEMPLATE") | ||
output_build="$(get_all_assigned_options_to_string_helper "$KW_BUILD_CONFIG_SAMPLE")" | ||
output_deploy="$(get_all_assigned_options_to_string_helper "$KW_DEPLOY_CONFIG_SAMPLE")" | ||
output_vm="$(get_all_assigned_options_to_string_helper "$KW_VM_CONFIG_SAMPLE")" | ||
output_mail="$(get_all_assigned_options_to_string_helper "$KW_MAIL_CONFIG_SAMPLE")" | ||
output_notification="$(get_all_assigned_options_to_string_helper "$KW_NOTIFICATION_CONFIG_SAMPLE")" | ||
|
||
output+=" $output_build $output_deploy $output_vm $output_mail $output_notification" | ||
for option in $output; do | ||
possible_options["$option"]=1 | ||
done | ||
|
||
cp "$KW_CONFIG_SAMPLE" "$TMPDIR_KW_FOLDER" | ||
cp "$KW_BUILD_CONFIG_SAMPLE" "$TMPDIR_KW_FOLDER" | ||
cp "$KW_VM_CONFIG_SAMPLE" "$TMPDIR_KW_FOLDER" | ||
cp "$KW_MAIL_CONFIG_SAMPLE" "$TMPDIR_KW_FOLDER" | ||
cp "$KW_NOTIFICATION_CONFIG_SAMPLE" "$TMPDIR_KW_FOLDER" | ||
cp "${SAMPLES_DIR}/deploy_all_options.config" "${TMPDIR_KW_FOLDER}/deploy.config" | ||
|
||
load_all_config | ||
|
||
output="$(show_variables_main 'TEST_MODE' | grep -E '^ ')" | ||
output="$(printf '%s\n' "$output" | sed 's/.*(\(\S*\)).*/\1/')" | ||
|
||
for option in $output; do | ||
shown_options["$option"]=1 | ||
done | ||
|
||
assert_configurations_helper possible_options shown_options "$LINENO" | ||
} | ||
|
||
function test_show_variables_main_correctness() | ||
{ | ||
local output | ||
local option | ||
local value | ||
local message | ||
|
||
# show_variables_main will load the config file, and for this test we want to | ||
# avoid this behaviour. For this reason, we are deleting the .kw folder | ||
rm -rf .kw | ||
|
||
declare -gA configurations=( | ||
[ssh_ip]=1 | ||
[ssh_port]=2 | ||
[mount_point]='/home/lala' | ||
[menu_config]=4 | ||
[virtualizer]='libvirt' | ||
[qemu_hw_options]=6 | ||
[qemu_net_options]=7 | ||
[qemu_path_image]='/home/xpto/p/virty.qcow2' | ||
[alert]='n' | ||
[sound_alert_command]='paplay SOUNDPATH/bell.wav' | ||
[visual_alert_command]='notify-send lala' | ||
[default_deploy_target]=vm | ||
[reboot_after_deploy]='no' | ||
[deploy_temporary_files_path]='/tmp/kw' | ||
[dtb_copy_pattern]='broadcom/*.dtb' | ||
[strip_modules_debug_option]='yes' | ||
[deploy_default_compression]='lzop' | ||
[kw_files_remote_path]='/opt/kw' | ||
[send_opts]='--annotate --cover-letter --no-chain-reply-to --thread' | ||
[blocked_emails]='[email protected]' | ||
[disable_statistics_data_track]=14 | ||
[gui_on]=15 | ||
[gui_off]=16 | ||
) | ||
|
||
output="$(show_variables_main | grep -E '^\s{3,}')" | ||
|
||
# The `read` command will read all the characters untill it finds a newline | ||
# character and then write those characters onto the given variable (in this | ||
# case, the `line` variable). If it does not find a newline `\n` character, it | ||
# will exit with status code 1. This evaluates to false, which means the | ||
# shellscript exits the loop. Therefore, if the last line is not empty but | ||
# misses the newline character, the loop won't be run and the last config | ||
# option won't be read. We handle this edge case by checking if line is not | ||
# empty and proceeding to run the loop once more if necessary. | ||
# | ||
# shellcheck disable=SC2162 | ||
while read -r line || [[ -n "$line" ]]; do | ||
option="$(printf '%s\n' "$line" | sed -E 's/.*\((\S*)\).*/\1/')" | ||
value=$(printf '%s\n' "$line" | sed -E 's/.*: (.*)/\1/') | ||
if [[ "${configurations[$option]}" != "$value" ]]; then | ||
message="Value of option $option should be " | ||
message+="${configurations["$option"]} but is $value" | ||
fail "($LINENO): $message" | ||
fi | ||
done <<< "$output" | ||
} | ||
|
||
function test_load_configuration() | ||
{ | ||
local msg='We will stop supporting kworkflow.config in the kernel root directory in favor of using a .kw/ directory.' | ||
|