Print error msg when forget to specify user for ssh target
Resolves: https://issues.redhat.com/browse/FC-1046 We require that <user> be explicitly specified in 'ssh <user>@<hostname>'. When forgetting to specify, such as 'ssh 192.168.10.2', a useful error log should be printed instead of exiting directly. Signed-off-by: Lichen Liu <lichliu@redhat.com> Reviewed-by: Philipp Rudo <prudo@redhat.com>
This commit is contained in:
parent
753e5060d7
commit
6943de2cdc
7
kdumpctl
7
kdumpctl
@ -748,7 +748,12 @@ check_ssh_config()
|
||||
[[ "${OPT[_fstype]}" == ssh ]] || return 0
|
||||
|
||||
target=$(ssh -G "${OPT[_target]}" | sed -n -e "s/^hostname[[:space:]]\+\([^[:space:]]*\).*$/\1/p")
|
||||
[[ ${OPT[_target]} =~ .*@.* ]] || return 1
|
||||
|
||||
if [[ ${OPT[_target]} != *@* ]]; then
|
||||
derror "Please verify that $KDUMP_CONFIG_FILE contains 'ssh <user>@<host>' and that it is properly formatted."
|
||||
return 1
|
||||
fi
|
||||
|
||||
if [[ ${OPT[_target]#*@} != "$target" ]]; then
|
||||
derror "Invalid ssh destination ${OPT[_target]} provided."
|
||||
return 1
|
||||
|
Loading…
Reference in New Issue
Block a user