Jaume Devesa 95c87ea79b MidoNet services manifests
Provide TripleO overcloud manifests to deploy MidoNet and the cluster
services that needs to run.

Change-Id: I24f852e74fc4652d4609e1a71897e813448055fe
2015-11-23 11:53:07 +01:00

15 lines
421 B
Ruby

# Custom function to extract the index from a list.
# The list are a list of hostname, and the index is the n'th
# position of the host in list
module Puppet::Parser::Functions
newfunction(:extract_id, :type => :rvalue) do |argv|
hosts = argv[0]
if hosts.class != Array
hosts = [hosts]
end
hostname = argv[1]
hash = Hash[hosts.map.with_index.to_a]
return hash[hostname].to_i + 1
end
end