On 12/04/14 at 03:28pm, Vivek Goyal wrote:
On Thu, Dec 04, 2014 at 02:45:32PM +0800, WANG Chao wrote:
> "default" option only takes reboot/halt/poweroff/shell/dump_to_rootfs as
> its config value. Otherwise kdump service fails early.
>
> Signed-off-by: WANG Chao <chaowang(a)redhat.com>
Chao,
It is good to do extra error checking and fail early. Just that a case
statement inside case statement is making it look ugly and hard to
read.
How about introduing a helper function?
OK. I'll introduce a new helper function.
Thanks
WANG Chao
Thanks
Vivek
> ---
> kdumpctl | 12 +++++++++++-
> 1 file changed, 11 insertions(+), 1 deletion(-)
>
> diff --git a/kdumpctl b/kdumpctl
> index ee3214a..8d27086 100755
> --- a/kdumpctl
> +++ b/kdumpctl
> @@ -242,7 +242,7 @@ check_config()
> case "$config_opt" in
> \#* | "")
> ;;
>
- raw|ext2|ext3|ext4|minix|btrfs|xfs|nfs|ssh|sshkey|path|core_collector|kdump_post|kdump_pre|extra_bins|extra_modules|default|force_rebuild|dracut_args|fence_kdump_args|fence_kdump_nodes)
>
+ raw|ext2|ext3|ext4|minix|btrfs|xfs|nfs|ssh|sshkey|path|core_collector|kdump_post|kdump_pre|extra_bins|extra_modules|force_rebuild|dracut_args|fence_kdump_args|fence_kdump_nodes)
> [ -z "$config_val" ] && {
> echo "Invalid kdump config value for option $config_opt."
> return 1;
> @@ -252,6 +252,16 @@ check_config()
> echo "Deprecated kdump config option: $config_opt. Refer to kdump.conf
manpage for alternatives."
> return 1
> ;;
> + default)
> + case "$config_val" in
> + reboot|halt|poweroff|shell|dump_to_rootfs)
> + ;;
> + *)
> + echo "Invalid kdump config value for option $config_opt."
> + return 1
> + ;;
> + esac
> + ;;
> *)
> echo "Invalid kdump config option $config_opt"
> return 1;
> --
> 1.9.3
>
> _______________________________________________
> kexec mailing list
> kexec(a)lists.fedoraproject.org
>
https://lists.fedoraproject.org/mailman/listinfo/kexec