TT#38200 Switch to new perl ngcp.get_firstname() function

Change-Id: I0802fa8988d7bf84a1ca8caa3770e86d69ba079a
changes/72/22072/3
Guillem Jover 8 years ago
parent 1ecd9f92ac
commit 5d35213a3a

@ -68,6 +68,20 @@ sub get_peername
return $self->{config}{hosts}{$hostname}{peer};
}
sub get_firstname
{
my ($self, $hostname) = @_;
if (not defined $self->{config}{hosts}{$hostname}) {
return 'self';
} else {
my $peername = $self->get_peername($hostname);
my @hosts = ($hostname, $peername);
return (sort @hosts)[0];
}
}
1;
__END__
@ -111,6 +125,11 @@ Returns the nodename of the node calling this function.
Returns the peer name for a given $hostname.
=item $firstname = $t->get_firstname($hostname)
Returns the (alphabetically) first hostname of a node pair for a given
$hostname.
=back
=head1 AUTHOR

@ -6,14 +6,6 @@
# @param argv.host The hostname to get the first name for.
# @return out The alphabetically first name.
IF !hosts.${argv.host}.defined;
argv.host = 'self';
END;
blktmp.hosts = [argv.host];
IF hosts.${argv.host}.peer.defined;
blktmp.hosts.push(hosts.${argv.host}.peer);
END;
out = blktmp.hosts.sort.0;
out = ngcp.get_firstname(argv.host);
-%]

Loading…
Cancel
Save