From 1fbfe531b7c579d8fb6494946288a51d05e973b2 Mon Sep 17 00:00:00 2001 From: Paul de Raaij Date: Thu, 3 Apr 2014 11:59:47 +0200 Subject: [PATCH] Add configuring multiple resolvers via an array instead of a string --- manifests/resource/vhost.pp | 8 +++----- templates/vhost/vhost_ssl_header.erb | 4 ++-- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/manifests/resource/vhost.pp b/manifests/resource/vhost.pp index 453984d..83f23bc 100644 --- a/manifests/resource/vhost.pp +++ b/manifests/resource/vhost.pp @@ -34,7 +34,7 @@ # nginx::resource::upstream # [*proxy_read_timeout*] - Override the default the proxy read timeout value # of 90 seconds -# [*resolver*] - String: Configures name servers used to resolve +# [*resolver*] - Array: Configures name servers used to resolve # names of upstream servers into addresses. # [*fastcgi*] - location of fastcgi (host:port) # [*fastcgi_params*] - optional alternative fastcgi_params file to use @@ -151,7 +151,7 @@ define nginx::resource::vhost ( $proxy_cache_valid = false, $proxy_method = undef, $proxy_set_body = undef, - $resolver = undef, + $resolver = [], $fastcgi = undef, $fastcgi_params = '/etc/nginx/fastcgi_params', $fastcgi_script = undef, @@ -248,9 +248,7 @@ define nginx::resource::vhost ( if ($proxy_set_body != undef) { validate_string($proxy_set_body) } - if ($resolver != undef) { - validate_string($resolver) - } + validate_array($resolver) if ($fastcgi != undef) { validate_string($fastcgi) } diff --git a/templates/vhost/vhost_ssl_header.erb b/templates/vhost/vhost_ssl_header.erb index e165b71..33fb36b 100644 --- a/templates/vhost/vhost_ssl_header.erb +++ b/templates/vhost/vhost_ssl_header.erb @@ -32,8 +32,8 @@ server { <% if defined? @ssl_trusted_cert -%> ssl_trusted_certificate <%= scope.lookupvar('nginx::params::nx_conf_dir') %>/<%= @name.gsub(' ', '_') %>.trusted.crt; <% end -%> -<% if defined? @resolver -%> - resolver <%= @resolver %>; +<% if @resolver.count > 0 -%> + resolver <% Array(@resolver).each do |r| %> <%= r %><% end %>; <% end -%> <% if defined? @auth_basic -%> auth_basic "<%= @auth_basic %>";