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_all_shared_names_by_role

21 lines
648 B

[%
# Return an array of Carrier nodes shared names with a given role
#
# @param argv.role The role of the node to process
# One of: proxy, lb, mgmt
# @return out The array of shared names:
# [ 'prx01', 'prx02', 'prx05' ]
out = []
blktmp.processed_hosts = {};
FOREACH host IN hosts.keys.sort;
NEXT IF blktmp.processed_hosts.$host.defined;
NEXT UNLESS hosts.$host.role.grep('^' _ argv.role _ '$').size();
peer = hosts.$host.peer;
blktmp.processed_hosts.$peer = 1;
matches = host.match('^(\w+[0-9])[ab]$');
out.push(matches.0);
END;
out = out.sort;
-%]