From 4e2f02288859305a4f8d46f2fd36c7392d0fe873 Mon Sep 17 00:00:00 2001 From: Brian Vanderbusch Date: Sat, 31 Mar 2018 09:38:31 -0500 Subject: [PATCH 1/4] removed git_data_dir and db:setup - removed and documented . Closes #159 - removed the automatic execution of if service_manage =true and postgresql hash has configs but enable is undef || present. closes #35 --- manifests/config.pp | 8 +------- manifests/init.pp | 5 ++--- spec/classes/init_spec.rb | 15 ++++----------- templates/gitlab.rb.erb | 6 ------ 4 files changed, 7 insertions(+), 27 deletions(-) diff --git a/manifests/config.pp b/manifests/config.pp index f02cce97..0c116c7a 100644 --- a/manifests/config.pp +++ b/manifests/config.pp @@ -17,13 +17,7 @@ $geo_secondary_role = $::gitlab::geo_secondary_role $git = $::gitlab::git $gitaly = $::gitlab::gitaly - $git_data_dir = $::gitlab::git_data_dir - # git_data_dirs is the new way to specify data_dirs, introduced in 8.10 - if $git_data_dir { - $git_data_dirs = merge({ 'default' => { 'path' => $::gitlab::git_data_dir} }, $::gitlab::git_data_dirs) - } else { - $git_data_dirs = $::gitlab::git_data_dirs - } + $git_data_dirs = $::gitlab::git_data_dirs $gitlab_git_http_server = $::gitlab::gitlab_git_http_server $gitlab_ci = $::gitlab::gitlab_ci $gitlab_pages = $::gitlab::gitlab_pages diff --git a/manifests/init.pp b/manifests/init.pp index 609ed8ac..32734e88 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -115,9 +115,9 @@ # Default: undef # Hash of 'Gitaly' config parameters. # -# [*git_data_dir*] +# [*git_data_dirs*] # Default: undef -# Git data dir +# Hash of git data directories # # [*gitlab_git_http_server*] # Default: undef @@ -376,7 +376,6 @@ Boolean $geo_secondary_role = false, Optional[Hash] $git = undef, Optional[Hash] $gitaly = undef, - Optional[Stdlib::Absolutepath] $git_data_dir = undef, Optional[Hash] $git_data_dirs = undef, Optional[Hash] $gitlab_git_http_server = undef, Optional[Hash] $gitlab_ci = undef, diff --git a/spec/classes/init_spec.rb b/spec/classes/init_spec.rb index 98fbb1c1..299c5d84 100644 --- a/spec/classes/init_spec.rb +++ b/spec/classes/init_spec.rb @@ -222,23 +222,16 @@ let(:params) do { 'git_data_dirs' => { - 'default' => '/var/opt/gitlab/data', - 'alt' => '/opt/data' + 'default' => { + 'path' => '/git-data/data', + } } } end it do is_expected.to contain_file('/etc/gitlab/gitlab.rb'). - with_content(%r{^\s*git_data_dirs\(\{\"alt\"\=\>\"\/opt\/data\"\,\s\"default\"=>\"\/var\/opt\/gitlab\/data\"\}\)}) - end - end - describe 'without data_dirs' do - let(:params) { { git_data_dir: '/var/opt/data' } } - - it do - is_expected.to contain_file('/etc/gitlab/gitlab.rb'). - with_content(%r{"/var/opt/data"}) + with_content(%r{^\s*git_data_dirs\(\{\"default\"\=\>\{\"path\"=>\"\/git-data\/data\"\}\})}) end end describe 'with store_git_keys_in_db' do diff --git a/templates/gitlab.rb.erb b/templates/gitlab.rb.erb index 5dc47dc9..2d08ef24 100644 --- a/templates/gitlab.rb.erb +++ b/templates/gitlab.rb.erb @@ -42,12 +42,6 @@ external_url '<%= @external_url %>' <%- if @external_port -%> external_port '<%= @external_port %>' <%- end -%> -<%- if @git_data_dir -%> -## For setting up different data storing directory -## see https://gitlab.com/gitlab-org/omnibus-gitlab/blob/629def0a7a26e7c2326566f0758d4a27857b52a3/README.md#storing-git-data-in-an-alternative-directory -## If you want to use a single non-default directory to store git data use: -git_data_dir "<%= @git_data_dir %>" -<%- end -%> <%- if @git_data_dirs -%> ### For setting up different data storing directory From e708bc0b5e6e0fb9c0cc4870700617dfeab96223 Mon Sep 17 00:00:00 2001 From: Brian Vanderbusch Date: Sat, 31 Mar 2018 10:12:43 -0500 Subject: [PATCH 2/4] update test regex for git_data_dirs --- spec/classes/init_spec.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/spec/classes/init_spec.rb b/spec/classes/init_spec.rb index 299c5d84..bf1c1404 100644 --- a/spec/classes/init_spec.rb +++ b/spec/classes/init_spec.rb @@ -228,10 +228,13 @@ } } end + let(:expected_content) do + datadirs: %(git_data_dirs({\"default\"=>{\"path\"=>\"/git-data/data\"}})\n) + end it do is_expected.to contain_file('/etc/gitlab/gitlab.rb'). - with_content(%r{^\s*git_data_dirs\(\{\"default\"\=\>\{\"path\"=>\"\/git-data\/data\"\}\})}) + with_content(%r{\s*#{Regexp.quote(expected_content[:datadirs])}}m) end end describe 'with store_git_keys_in_db' do From 4a92e6f17075da3229dee84c1803a81c608fceb2 Mon Sep 17 00:00:00 2001 From: Brian Vanderbusch Date: Sat, 31 Mar 2018 10:31:10 -0500 Subject: [PATCH 3/4] fix syntax for init_spec.rb --- spec/classes/init_spec.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/spec/classes/init_spec.rb b/spec/classes/init_spec.rb index bf1c1404..a609d8b7 100644 --- a/spec/classes/init_spec.rb +++ b/spec/classes/init_spec.rb @@ -229,7 +229,9 @@ } end let(:expected_content) do - datadirs: %(git_data_dirs({\"default\"=>{\"path\"=>\"/git-data/data\"}})\n) + { + datadirs: %(git_data_dirs({\"default\"=>{\"path\"=>\"/git-data/data\"}})\n) + } end it do From ec10a193713693f30395699b62aacc5c7655a24d Mon Sep 17 00:00:00 2001 From: Brian Vanderbusch Date: Sat, 31 Mar 2018 10:42:56 -0500 Subject: [PATCH 4/4] removing uneeded comma for rubocop --- spec/classes/init_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/classes/init_spec.rb b/spec/classes/init_spec.rb index a609d8b7..b350c0a1 100644 --- a/spec/classes/init_spec.rb +++ b/spec/classes/init_spec.rb @@ -223,7 +223,7 @@ { 'git_data_dirs' => { 'default' => { - 'path' => '/git-data/data', + 'path' => '/git-data/data' } } }