From 57557202f5ccd16ccd276ce3997a3f8d370e8c60 Mon Sep 17 00:00:00 2001 From: Hunter Haugen Date: Fri, 12 Oct 2012 15:08:10 -0700 Subject: No need to manually set ordering --- manifests/balancermember.pp | 10 +--------- manifests/listen.pp | 9 +-------- spec/defines/balancermember_spec.rb | 8 ++++---- spec/defines/listen_spec.rb | 6 +++--- 4 files changed, 9 insertions(+), 24 deletions(-) diff --git a/manifests/balancermember.pp b/manifests/balancermember.pp index a54d92e..a0e2753 100644 --- a/manifests/balancermember.pp +++ b/manifests/balancermember.pp @@ -32,11 +32,6 @@ # configuration. If you use an array in server_names and ipaddresses, the # same port is used for all balancermembers. # -# [*order*] -# The order, or numerical weight, of the fragment created by this defined -# resource type. This is necessary to ensure the fragment is associated -# with the correct listening service instance. -# # [*server_names*] # The name of the balancer member server as known to haproxy in the # listening service's configuration block. This defaults to the @@ -60,7 +55,6 @@ # @@haproxy::balancermember { 'haproxy': # listening_service => 'puppet00', # ports => '8140', -# order => '21', # server_names => $::hostname, # ipaddresses => $::ipaddress, # options => 'check', @@ -78,7 +72,6 @@ # haproxy::balancermember { 'haproxy': # listening_service => 'puppet00', # ports => '8140', -# order => '21', # server_names => ['server01', 'server02'], # ipaddresses => ['192.168.56.200', '192.168.56.201'], # options => 'check', @@ -89,14 +82,13 @@ define haproxy::balancermember ( $listening_service, $ports, - $order = '20', $server_names = $::hostname, $ipaddresses = $::ipaddress, $options = '' ) { # Template uses $ipaddresses, $server_name, $ports, $option concat::fragment { "${listening_service}_balancermember_${name}": - order => $order, + order => "20-${listening_service}-${name}", target => '/etc/haproxy/haproxy.cfg', content => template('haproxy/haproxy_balancermember.erb'), } diff --git a/manifests/listen.pp b/manifests/listen.pp index 40e2cf1..5dea8a8 100644 --- a/manifests/listen.pp +++ b/manifests/listen.pp @@ -26,11 +26,6 @@ # comma-separated string or an array of strings which may be ports or # hyphenated port ranges. # -# [*order*] -# The order, or numerical weight, of the fragment created by this defined -# resource type. This is necessary to ensure the fragment is associated -# with the correct listening service instance. -# # [*ipaddress*] # The ip address the proxy binds to. Empty addresses, '*', and '0.0.0.0' # mean that the proxy listens to all valid addresses on the system. @@ -56,7 +51,6 @@ # Exporting the resource for a balancer member: # # haproxy::listen { 'puppet00': -# order => '20', # ipaddress => $::ipaddress, # ports => '18140', # mode => 'tcp', @@ -75,7 +69,6 @@ # define haproxy::listen ( $ports, - $order = '20', $ipaddress = $::ipaddress, $mode = 'tcp', $collect_exported = true, @@ -89,7 +82,7 @@ define haproxy::listen ( ) { # Template uses: $name, $ipaddress, $ports, $options concat::fragment { "${name}_listen_block": - order => $order, + order => "20-${name}", target => '/etc/haproxy/haproxy.cfg', content => template('haproxy/haproxy_listen_block.erb'), } diff --git a/spec/defines/balancermember_spec.rb b/spec/defines/balancermember_spec.rb index 1a37673..74bc7a8 100644 --- a/spec/defines/balancermember_spec.rb +++ b/spec/defines/balancermember_spec.rb @@ -20,7 +20,7 @@ describe 'haproxy::balancermember' do end it { should contain_concat__fragment('croy_balancermember_tyler').with( - 'order' => '20', + 'order' => '20-croy-tyler', 'target' => '/etc/haproxy/haproxy.cfg', 'content' => " server dero 1.1.1.1:18140 check\n\n" ) } @@ -37,7 +37,7 @@ describe 'haproxy::balancermember' do end it { should contain_concat__fragment('croy_balancermember_tyler').with( - 'order' => '20', + 'order' => '20-croy-tyler', 'target' => '/etc/haproxy/haproxy.cfg', 'content' => " server dero 1.1.1.1:18140 check close\n\n" ) } @@ -56,7 +56,7 @@ describe 'haproxy::balancermember' do end it { should contain_concat__fragment('croy_balancermember_tyler').with( - 'order' => '20', + 'order' => '20-croy-tyler', 'target' => '/etc/haproxy/haproxy.cfg', 'content' => " server server01 192.168.56.200:18140 check\n server server02 192.168.56.201:18140 check\n\n" ) } @@ -74,7 +74,7 @@ describe 'haproxy::balancermember' do end it { should contain_concat__fragment('croy_balancermember_tyler').with( - 'order' => '20', + 'order' => '20-croy-tyler', 'target' => '/etc/haproxy/haproxy.cfg', 'content' => " server server01 192.168.56.200:18140,192.168.56.200:18150 check\n server server02 192.168.56.201:18140,192.168.56.201:18150 check\n\n" ) } diff --git a/spec/defines/listen_spec.rb b/spec/defines/listen_spec.rb index 16a0cfa..fa54409 100644 --- a/spec/defines/listen_spec.rb +++ b/spec/defines/listen_spec.rb @@ -12,7 +12,7 @@ describe 'haproxy::listen' do end it { should contain_concat__fragment('croy_listen_block').with( - 'order' => '20', + 'order' => '20-croy', 'target' => '/etc/haproxy/haproxy.cfg', 'content' => "\nlisten croy 1.1.1.1:18140\n balance roundrobin\n option tcplog\n option ssl-hello-chk\n" ) } @@ -30,7 +30,7 @@ describe 'haproxy::listen' do end it { should contain_concat__fragment('apache_listen_block').with( - 'order' => '20', + 'order' => '20-apache', 'target' => '/etc/haproxy/haproxy.cfg', 'content' => "\nlisten apache 23.23.23.23:80,23.23.23.23:443\n balance roundrobin\n option tcplog\n option ssl-hello-chk\n" ) } @@ -45,7 +45,7 @@ describe 'haproxy::listen' do end it { should contain_concat__fragment('apache_listen_block').with( - 'order' => '20', + 'order' => '20-apache', 'target' => '/etc/haproxy/haproxy.cfg', 'content' => "\nlisten apache 23.23.23.23:80,23.23.23.23:443\n balance roundrobin\n option tcplog\n option ssl-hello-chk\n" ) } -- cgit v1.2.3