add ipsort function for RHOS deployment order

This commit is contained in:
Matthew Mosesohn 2013-10-22 20:54:10 +04:00 committed by Dmitry Borodaenko
parent 51f529c1bb
commit 03ecafb819
2 changed files with 14 additions and 1 deletions

View File

@ -0,0 +1,13 @@
module Puppet::Parser::Functions
newfunction(:ipsort, :type => :rvalue , :doc => <<-EOS
Returns list sorted of sorted IP addresses.
EOS
) do |args|
require 'rubygems'
require 'ipaddr'
ips = args[0]
sorted_ips = ips.sort { |a,b| IPAddr.new( a ) <=> IPAddr.new( b ) }
sorted_ips
end
end

View File

@ -119,7 +119,7 @@ class osnailyfacter::cluster_ha {
$controller_public_addresses = nodes_to_hash($controllers,'name','public_address')
$controller_storage_addresses = nodes_to_hash($controllers,'name','storage_address')
$controller_hostnames = keys($controller_internal_addresses)
$controller_nodes = sort(values($controller_internal_addresses))
$controller_nodes = ipsort(values($controller_internal_addresses))
$controller_node_public = $::fuel_settings['public_vip']
$controller_node_address = $::fuel_settings['management_vip']
$mountpoints = filter_hash($mp_hash,'point')