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_firstname

16 lines
450 B

[%
# Returns the (alphabetically) first hostname of a node pair for
# a given host.
#
# @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 -%]