kdumpctl: fix check_config error when kdump.conf is empty

Resolves: bz1975632
Upstream: Fedora
Conflict: None

commit 6137956f79
Author: Kairui Song <kasong@redhat.com>
Date:   Wed Apr 14 13:41:19 2021 +0800

    kdumpctl: fix check_config error when kdump.conf is empty

    Kdump scirpt already have default values for core_collector, path in
    many other place. Empty kdump.conf still works. Fix this corner case and
    fix the error message.

    Signed-off-by: Kairui Song <kasong@redhat.com>
    Acked-by: Pingfan Liu <piliu@redhat.com>

Signed-off-by: Tao Liu <ltao@redhat.com>
This commit is contained in:
Tao Liu 2021-06-25 11:47:35 +08:00
parent 8ce1f3c1df
commit ba2668b537
1 changed files with 9 additions and 6 deletions

View File

@ -237,12 +237,7 @@ restore_default_initrd()
check_config()
{
local -A _opt_rec
while read config_opt config_val; do
if [ -z "$config_val" ]; then
derror "Invalid kdump config value for option $config_opt"
return 1
fi
while read -r config_opt config_val; do
case "$config_opt" in
dracut_args)
if [[ $config_val == *--mount* ]]; then
@ -268,12 +263,20 @@ check_config()
derror "Deprecated kdump config option: $config_opt. Refer to kdump.conf manpage for alternatives."
return 1
;;
'')
continue
;;
*)
derror "Invalid kdump config option $config_opt"
return 1
;;
esac
if [[ -z "$config_val" ]]; then
derror "Invalid kdump config value for option '$config_opt'"
return 1
fi
if [ -n "${_opt_rec[$config_opt]}" ]; then
if [ $config_opt == _target ]; then
derror "More than one dump targets specified"