TT#16162 Add lib/get_all_shared_names_by_role (extracted from mysql_values.cfg)

Change-Id: I9e493b0d36cf45a07a2387eb14f942c5e5b28ce6
changes/77/13177/2
Alexander Lutay 9 years ago
parent 150d2a5e2e
commit 42624f5c60

@ -0,0 +1,20 @@
[%
# 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;
-%]
Loading…
Cancel
Save