From 739058a72d70c299c65410e87212f9dcbcabaa6d Mon Sep 17 00:00:00 2001 From: Matthieu Vachon Date: Wed, 18 Jun 2014 18:51:00 -0400 Subject: [PATCH] Added possibility to install nginx manually --- attributes/default.rb | 3 ++- recipes/nginx.rb | 2 +- spec/nginx_spec.rb | 26 ++++++++++++++++++++++++++ 3 files changed, 29 insertions(+), 2 deletions(-) diff --git a/attributes/default.rb b/attributes/default.rb index 2a311a4..bf6b15e 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -169,7 +169,8 @@ default['postfix']['smtp_use_tls'] = "no" default['gitlab']['unicorn_workers_number'] = 2 default['gitlab']['unicorn_timeout'] = 30 -# Nginx ssl certificates +# Nginx & Nginx ssl certificates +default['gitlab']['install_nginx'] = true default['gitlab']['ssl_certificate_path'] = "/etc/ssl" # Path to .crt file. If it directory doesn't exist it will be created default['gitlab']['ssl_certificate_key_path'] = "/etc/ssl" # Path to .key file. If directory doesn't exist it will be created default['gitlab']['ssl_certificate'] = "" # SSL certificate diff --git a/recipes/nginx.rb b/recipes/nginx.rb index 2163c8a..d775ebb 100644 --- a/recipes/nginx.rb +++ b/recipes/nginx.rb @@ -9,7 +9,7 @@ gitlab = node['gitlab'] ## Installation package "nginx" do action :install -end +end if gitlab['install_nginx'] ## Site Configuration path = platform_family?("rhel") ? "/etc/nginx/conf.d/gitlab.conf" : "/etc/nginx/sites-available/gitlab" diff --git a/spec/nginx_spec.rb b/spec/nginx_spec.rb index e554f78..72a3257 100644 --- a/spec/nginx_spec.rb +++ b/spec/nginx_spec.rb @@ -76,6 +76,19 @@ describe "gitlab::nginx" do expect(chef_run).to_not create_directory('/data/git') end end + + describe "when customizing install_nginx" do + let(:chef_run) do + runner = ChefSpec::Runner.new(platform: "ubuntu", version: version) + runner.node.set['gitlab']['env'] = "production" + runner.node.set['gitlab']['install_nginx'] = false + runner.converge("gitlab::nginx") + end + + it 'does not install nginx' do + expect(chef_run).to_not install_package('nginx') + end + end end end @@ -147,6 +160,19 @@ describe "gitlab::nginx" do expect(chef_run).to create_directory('/data/git') end end + + describe "when customizing install_nginx" do + let(:chef_run) do + runner = ChefSpec::Runner.new(platform: "centos", version: version) + runner.node.set['gitlab']['env'] = "production" + runner.node.set['gitlab']['install_nginx'] = false + runner.converge("gitlab::nginx") + end + + it 'does not install nginx' do + expect(chef_run).to_not install_package('nginx') + end + end end end end -- 2.22.0