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_iface

25 lines
596 B

[%
# vi: ft=tt2
# Returns the interface name with a certain type for a given host.
#
# @param argv.host The hostname to get the interface from.
# @param argv.type The interface type, one of:
# web_int, web_ext, sip_int, sip_ext, ...
# @return out The interface name.
IF !hosts.${argv.host}.defined;
argv.host = 'self';
END;
out = '';
FOREACH iface IN hosts.${argv.host}.interfaces;
NEXT UNLESS hosts.${argv.host}.exists(iface);
NEXT UNLESS hosts.${argv.host}.$iface.type.grep('^' _ argv.type _ '$').size();
out = iface;
RETURN;
END;
-%]