diff --git a/.travis/Gemfile b/.travis/Gemfile index 8af652f25..252d3963d 100644 --- a/.travis/Gemfile +++ b/.travis/Gemfile @@ -2,7 +2,7 @@ source 'https://rubygems.org' group :rake do gem 'puppetlabs_spec_helper' - gem 'librarian-puppet-maestrodev' + gem 'librarian-puppet' gem 'open3_backport', :platforms => :ruby_18 gem 'json', :platforms => :ruby_18 end diff --git a/Gemfile b/Gemfile index 513b910ae..26c7d4a18 100644 --- a/Gemfile +++ b/Gemfile @@ -7,7 +7,7 @@ group :rake do gem 'puppet-lint', '>=0.1.12' gem 'puppetlabs_spec_helper' gem 'puppet-blacksmith' - gem 'librarian-puppet-maestrodev' + gem 'librarian-puppet' gem 'rspec-system-puppet', :require => false gem 'rspec-system-serverspec', :require => false end diff --git a/spec/classes/config_spec.rb b/spec/classes/config_spec.rb index 6076e5481..257b61b81 100644 --- a/spec/classes/config_spec.rb +++ b/spec/classes/config_spec.rb @@ -230,12 +230,6 @@ describe "proxy.conf template content" do [ - { - :title => 'should set client_max_body_size', - :attr => 'client_max_body_size', - :value => '5m', - :match => 'client_max_body_size 5m;', - }, { :title => 'should set proxy_buffers', :attr => 'proxy_buffers', diff --git a/spec/defines/resource_location_spec.rb b/spec/defines/resource_location_spec.rb index 23cc8acf3..999212ff2 100644 --- a/spec/defines/resource_location_spec.rb +++ b/spec/defines/resource_location_spec.rb @@ -1,4 +1,5 @@ require 'spec_helper' +require 'digest/md5' describe 'nginx::resource::location' do let :title do @@ -27,7 +28,7 @@ it { should contain_class("nginx::params") } it { should contain_class("nginx::config") } - it { should contain_concat__fragment("vhost1-500-rspec-test").with_content(/location rspec-test/) } + it { should contain_concat__fragment("f25e14942fb58942ee13b1465a4e1719").with_content(/location rspec-test/) } it { should_not contain_file('/etc/nginx/fastcgi_params') } it { should_not contain_concat__fragment("vhost1-800-rspec-test-ssl") } it { should_not contain_file("/etc/nginx/rspec-test_htpasswd") } @@ -134,12 +135,12 @@ let :default_params do { :location => 'location', :proxy => 'proxy_value', :vhost => 'vhost1' } end let :params do default_params.merge({ param[:attr].to_sym => param[:value] }) end - it { should contain_concat__fragment("vhost1-500-#{params[:location]}") } + it { should contain_concat__fragment(Digest::MD5.hexdigest("vhost1-500-#{params[:location]}")) } it param[:title] do - lines = subject.resource('concat::fragment', "vhost1-500-#{params[:location]}").send(:parameters)[:content].split("\n") + lines = subject.resource('concat::fragment', Digest::MD5.hexdigest("vhost1-500-#{params[:location]}")).send(:parameters)[:content].split("\n") (lines & Array(param[:match])).should == Array(param[:match]) Array(param[:notmatch]).each do |item| - should contain_concat__fragment("vhost1-500-#{params[:location]}").without_content(item) + should contain_concat__fragment(Digest::MD5.hexdigest("vhost1-500-#{params[:location]}")).without_content(item) end end end @@ -154,7 +155,7 @@ :proxy_cache_valid => '10m', } end - it { should contain_concat__fragment("vhost1-500-location").with_content(/proxy_cache_valid 10m;/) } + it { should contain_concat__fragment(Digest::MD5.hexdigest("vhost1-500-location")).with_content(/proxy_cache_valid 10m;/) } end end @@ -209,12 +210,12 @@ let :default_params do { :location => 'location', :location_alias => 'location_alias_value', :vhost => 'vhost1' } end let :params do default_params.merge({ param[:attr].to_sym => param[:value] }) end - it { should contain_concat__fragment("vhost1-500-#{params[:location]}") } + it { should contain_concat__fragment(Digest::MD5.hexdigest("vhost1-500-#{params[:location]}")) } it param[:title] do - lines = subject.resource('concat::fragment', "vhost1-500-#{params[:location]}").send(:parameters)[:content].split("\n") + lines = subject.resource('concat::fragment', Digest::MD5.hexdigest("vhost1-500-#{params[:location]}")).send(:parameters)[:content].split("\n") (lines & Array(param[:match])).should == Array(param[:match]) Array(param[:notmatch]).each do |item| - should contain_concat__fragment("vhost1-500-#{params[:location]}").without_content(item) + should contain_concat__fragment(Digest::MD5.hexdigest("vhost1-500-#{params[:location]}")).without_content(item) end end end @@ -266,12 +267,12 @@ let :default_params do { :location => 'location', :stub_status => true, :vhost => 'vhost1' } end let :params do default_params.merge({ param[:attr].to_sym => param[:value] }) end - it { should contain_concat__fragment("vhost1-500-#{params[:location]}") } + it { should contain_concat__fragment(Digest::MD5.hexdigest("vhost1-500-#{params[:location]}")) } it param[:title] do - lines = subject.resource('concat::fragment', "vhost1-500-#{params[:location]}").send(:parameters)[:content].split("\n") + lines = subject.resource('concat::fragment', Digest::MD5.hexdigest("vhost1-500-#{params[:location]}")).send(:parameters)[:content].split("\n") (lines & Array(param[:match])).should == Array(param[:match]) Array(param[:notmatch]).each do |item| - should contain_concat__fragment("vhost1-500-#{params[:location]}").without_content(item) + should contain_concat__fragment(Digest::MD5.hexdigest("vhost1-500-#{params[:location]}")).without_content(item) end end end @@ -359,12 +360,12 @@ let :default_params do { :location => 'location', :fastcgi => 'localhost:9000', :vhost => 'vhost1' } end let :params do default_params.merge({ param[:attr].to_sym => param[:value] }) end - it { should contain_concat__fragment("vhost1-500-#{params[:location]}") } + it { should contain_concat__fragment(Digest::MD5.hexdigest("vhost1-500-#{params[:location]}")) } it param[:title] do - lines = subject.resource('concat::fragment', "vhost1-500-#{params[:location]}").send(:parameters)[:content].split("\n") + lines = subject.resource('concat::fragment', Digest::MD5.hexdigest("vhost1-500-#{params[:location]}")).send(:parameters)[:content].split("\n") (lines & Array(param[:match])).should == Array(param[:match]) Array(param[:notmatch]).each do |item| - should contain_concat__fragment("vhost1-500-#{params[:location]}").without_content(/#{item}/) + should contain_concat__fragment(Digest::MD5.hexdigest("vhost1-500-#{params[:location]}")).without_content(/#{item}/) end end end @@ -478,12 +479,12 @@ let :default_params do { :location => 'location', :www_root => '/var/www/root', :vhost => 'vhost1' } end let :params do default_params.merge({ param[:attr].to_sym => param[:value] }) end - it { should contain_concat__fragment("vhost1-500-#{params[:location]}") } + it { should contain_concat__fragment(Digest::MD5.hexdigest("vhost1-500-#{params[:location]}")) } it param[:title] do - lines = subject.resource('concat::fragment', "vhost1-500-#{params[:location]}").send(:parameters)[:content].split("\n") + lines = subject.resource('concat::fragment', Digest::MD5.hexdigest("vhost1-500-#{params[:location]}")).send(:parameters)[:content].split("\n") (lines & Array(param[:match])).should == Array(param[:match]) Array(param[:notmatch]).each do |item| - should contain_concat__fragment("vhost1-500-#{params[:location]}").without_content(item) + should contain_concat__fragment(Digest::MD5.hexdigest("vhost1-500-#{params[:location]}")).without_content(item) end end end @@ -519,12 +520,12 @@ let :default_params do { :location => 'location', :location_custom_cfg => {'test1'=>'value1'}, :vhost => 'vhost1' } end let :params do default_params.merge({ param[:attr].to_sym => param[:value] }) end - it { should contain_concat__fragment("vhost1-500-#{params[:location]}") } + it { should contain_concat__fragment(Digest::MD5.hexdigest("vhost1-500-#{params[:location]}")) } it param[:title] do - lines = subject.resource('concat::fragment', "vhost1-500-#{params[:location]}").send(:parameters)[:content].split("\n") + lines = subject.resource('concat::fragment', Digest::MD5.hexdigest("vhost1-500-#{params[:location]}")).send(:parameters)[:content].split("\n") (lines & Array(param[:match])).should == Array(param[:match]) Array(param[:notmatch]).each do |item| - should contain_concat__fragment("vhost1-500-#{params[:location]}").without_content(item) + should contain_concat__fragment(Digest::MD5.hexdigest("vhost1-500-#{params[:location]}")).without_content(item) end end end @@ -540,25 +541,25 @@ context 'when ssl_only => true' do let :params do { :ssl_only => true, :vhost => 'vhost1', :www_root => '/', } end - it { should_not contain_concat__fragment("vhost1-500-rspec-test") } + it { should_not contain_concat__fragment(Digest::MD5.hexdigest("vhost1-500-rspec-test")) } end context 'when ssl_only => false' do let :params do { :ssl_only => false, :vhost => 'vhost1', :www_root => '/', } end - it { should contain_concat__fragment("vhost1-500-rspec-test") } + it { should contain_concat__fragment(Digest::MD5.hexdigest("vhost1-500-rspec-test")) } end context 'when ssl => true' do let :params do { :ssl => true, :vhost => 'vhost1', :www_root => '/', } end - it { should contain_concat__fragment("vhost1-800-rspec-test-ssl") } + it { should contain_concat__fragment(Digest::MD5.hexdigest("vhost1-800-rspec-test-ssl")) } end context 'when ssl => false' do let :params do { :ssl => false, :vhost => 'vhost1', :www_root => '/', } end - it { should_not contain_concat__fragment("vhost1-800-rspec-test-ssl") } + it { should_not contain_concat__fragment(Digest::MD5.hexdigest("vhost1-800-rspec-test-ssl")) } end context 'when auth_basic_user_file => true' do @@ -613,8 +614,8 @@ :ssl => true, } end - it { should contain_concat__fragment("www_rspec-vhost_com-500-www.rspec-location.com").with_target('/etc/nginx/sites-available/www_rspec-vhost_com.conf') } - it { should contain_concat__fragment("www_rspec-vhost_com-800-www.rspec-location.com-ssl").with_target('/etc/nginx/sites-available/www_rspec-vhost_com.conf') } + it { should contain_concat__fragment(Digest::MD5.hexdigest("www_rspec-vhost_com-500-www.rspec-location.com")).with_target('/etc/nginx/sites-available/www_rspec-vhost_com.conf') } + it { should contain_concat__fragment(Digest::MD5.hexdigest("www_rspec-vhost_com-800-www.rspec-location.com-ssl")).with_target('/etc/nginx/sites-available/www_rspec-vhost_com.conf') } end end end diff --git a/spec/defines/resource_vhost_spec.rb b/spec/defines/resource_vhost_spec.rb index 9d4ef3d90..c43b47eb5 100644 --- a/spec/defines/resource_vhost_spec.rb +++ b/spec/defines/resource_vhost_spec.rb @@ -515,13 +515,13 @@ context "SSL cert missing" do let(:params) {{ :ssl => true, :ssl_key => 'key' }} - it { expect { should contain_class('nginx::resource::vhost') }.to raise_error(Puppet::Error, %r{nginx: SSL certificate/key \(ssl_cert/ssl_cert\) and/or SSL Private must be defined and exist on the target system\(s\)}) } + it { expect { should contain_class('nginx::resource::vhost') }.to raise_error(Puppet::Error) } end context "SSL key missing" do let(:params) {{ :ssl => true, :ssl_cert => 'cert' }} - it { expect { should contain_class('nginx::resource::vhost') }.to raise_error(Puppet::Error, %r{nginx: SSL certificate/key \(ssl_cert/ssl_cert\) and/or SSL Private must be defined and exist on the target system\(s\)}) } + it { expect { should contain_class('nginx::resource::vhost') }.to raise_error(Puppet::Error) } end context 'when use_default_location => true' do diff --git a/templates/conf.d/nginx.conf.erb b/templates/conf.d/nginx.conf.erb index 0ad683843..8d71472b2 100644 --- a/templates/conf.d/nginx.conf.erb +++ b/templates/conf.d/nginx.conf.erb @@ -6,7 +6,7 @@ error_log <%= @nginx_error_log %>; <% if scope.lookupvar('nginx::params::nx_pid') != false %>pid <%= scope.lookupvar('nginx::params::nx_pid')%>;<% end -%> events { - worker_connections <%= @worker_connections -%>; + worker_connections <%= @worker_connections -%>; <% if @multi_accept == 'on' -%> multi_accept on; <% end -%>