On 02/17/15 at 08:51pm, Minfei Huang wrote:
On 02/17/15 at 05:16pm, Baoquan He wrote:
> On 02/15/15 at 03:45pm, Minfei Huang wrote:
> > # check the remote server ip address tpye
> > is_ipv6_target()
>
> Could it be get_network_target, then call is_ipv6_address which is
> implemented later? It's a little uncomfortable with ipv6_target and
> ipv6_address. Kind of duplicate implementation.
>
Hi, Bao!
This function will parse the passed parameter, then return the true, if
the parameter is ipv6, otherwise is false. So I think the function is
better to start with "is_".
I mean code can be like below, and get_network_target can be reused
later.
{
local _target
$_target=$(get_network_target)
is_ipv6_address($_target)
}
Thanks
Minfei
> > {
> > - local _server _server_tmp
> > + local _target
> >
> > if is_ssh_dump_target; then
> > - _server=`get_option_value ssh`
> > + _target=`get_option_value ssh`
> > elif is_nfs_dump_target; then
> > - _server=`get_option_value nfs`
> > + _target=`get_option_value nfs`
> > fi
> >
> > - [ -z "$_server" ] && return 1
> > - _server=`get_remote_host $_server`
> > - _server_tmp=$_server
> > - _server=`getent ahosts $_server | head -n 1 | cut -d' ' -f1`
> > - _server=${_server:-$_server_tmp}
> > - echo $_server | grep -q ":"
> > + [ -z "$_target" ] && return 1
> > + _target=`get_remote_host $_target`
> > +
> > + echo $(get_ip_address $_target) | grep -q ":"
> > }
> > --
> > 2.2.2
> >