[%
# vi: ft=tt2

# Returns the hostname of the node calling this function.
#
# @return out           The hostname of the node calling this function.
-%]
[% PERL -%]
  # Do not trust hostname(1) as this might differ from the hostname of
  # the system which runs the installer, instead rely on /etc/hostname
  open my $hh, '<', '/etc/hostname' or die "Error opening /etc/hostname";
  my $hostname = <$hh>;
  close $hh;
  chomp $hostname;
  die "Fatal error retrieving hostname [$hostname]" unless length $hostname;
  $stash->set(out => $hostname);
[% END -%]
