You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ngcpcfg/lib/get_nodename

25 lines
579 B

[%
# vi: ft=tt2
# Returns the nodename of the node calling this function.
#
# @return out The nodename of the node calling this function.
-%]
[% PERL -%]
my $filename = '/etc/ngcp_ha_node';
$filename = '/etc/ngcp_nodename' unless -f $filename;
open my $hh, '<', $filename or die "Error opening $filename";
my $nodename = <$hh>;
close $hh;
chomp $nodename;
die "Fatal error retrieving nodename [$nodename]" unless length $nodename;
$stash->set(out => $nodename);
[% END -%]
[%-
IF hosts.self.defined && !hosts.${out}.defined;
out = 'self';
END;
-%]