From b7c098f89d124946bbadb9002e423eac0ff736b1 Mon Sep 17 00:00:00 2001 From: Hunter Haugen Date: Wed, 10 Oct 2012 17:21:21 -0700 Subject: Change `virtual_ip` to `listen_ip` Because it's not really virtual. --- manifests/config.pp | 23 ++++++++++++++--------- spec/defines/config_spec.rb | 7 ++++--- templates/haproxy_config_block.erb | 2 +- 3 files changed, 19 insertions(+), 13 deletions(-) diff --git a/manifests/config.pp b/manifests/config.pp index 974f213..b9caf15 100644 --- a/manifests/config.pp +++ b/manifests/config.pp @@ -30,7 +30,7 @@ # resource type. This is necessary to ensure the fragment is associated # with the correct listening service instance. # -# [*virtual_ip*] +# [*listen_ip*] # 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. # @@ -55,12 +55,17 @@ # Exporting the resource for a balancer member: # # haproxy::config { 'puppet00': -# order => '20', -# virtual_ip => $::ipaddress, -# virtual_ip_port => '18140', -# mode => 'tcp', -# haproxy_config_options => {'option' => ['tcplog', 'ssl-hello-chk'], -# 'balance' => 'roundrobin'}, +# order => '20', +# listen_ip => $::ipaddress, +# ports => '18140', +# mode => 'tcp', +# config_options => { +# 'option' => [ +# 'tcplog', +# 'ssl-hello-chk' +# ], +# 'balance' => 'roundrobin' +# }, # } # # === Authors @@ -70,11 +75,11 @@ define haproxy::config ( $ports, $order = '20', - $virtual_ip = $::ipaddress, + $listen_ip = $::ipaddress, $mode = 'tcp', $collect_exported = true, $config_options = { - 'option' => [ + 'option' => [ 'tcplog', 'ssl-hello-chk' ], diff --git a/spec/defines/config_spec.rb b/spec/defines/config_spec.rb index a30737e..6a1af44 100644 --- a/spec/defines/config_spec.rb +++ b/spec/defines/config_spec.rb @@ -18,8 +18,9 @@ describe 'haproxy::config' do end context "when an array of ports is provided" do let(:params) do - { :name => 'apache', - :ports => [ + { :name => 'apache', + :listen_ip => '23.23.23.23', + :ports => [ '80', '443', ] @@ -29,7 +30,7 @@ describe 'haproxy::config' do it { should contain_concat__fragment('apache_config_block').with( 'order' => '20', 'target' => '/etc/haproxy/haproxy.cfg', - 'content' => "\nlisten apache 1.1.1.1:80,1.1.1.1:443\n balance roundrobin\n option tcplog\n option ssl-hello-chk\n" + '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" ) } end end diff --git a/templates/haproxy_config_block.erb b/templates/haproxy_config_block.erb index 526249f..9223140 100644 --- a/templates/haproxy_config_block.erb +++ b/templates/haproxy_config_block.erb @@ -1,5 +1,5 @@ -listen <%= name %> <%= virtual_ip %>:<%= Array(ports).join(",#{virtual_ip}:") %> +listen <%= name %> <%= listen_ip %>:<%= Array(ports).join(",#{listen_ip}:") %> <% config_options.sort.each do |key, val| -%> <% if val.is_a?(Array) -%> <% val.each do |item| -%> -- cgit v1.2.3