Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds ability to specify git_data_dirs #110

Merged
merged 1 commit into from
May 22, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions manifests/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@
$external_port = $::gitlab::external_port
$git = $::gitlab::git
$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 = { 'default' => $::gitlab::git_data_dir }.merge($::gitlab::git_data_dirs)
} else {
$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
Expand Down
2 changes: 2 additions & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,7 @@
$external_port = undef,
$git = undef,
$git_data_dir = undef,
$git_data_dirs = {},
$gitlab_git_http_server = undef,
$gitlab_ci = undef,
$gitlab_pages = undef,
Expand Down Expand Up @@ -357,6 +358,7 @@
validate_string($external_url)
if $git { validate_hash($git) }
if $git_data_dir { validate_absolute_path($git_data_dir) }
if $git_data_dirs { validate_hash($git_data_dirs) }
if $gitlab_git_http_server { validate_hash($gitlab_git_http_server) }
if $gitlab_pages { validate_hash($gitlab_pages) }
if $gitlab_workhorse { validate_hash($gitlab_workhorse) }
Expand Down
21 changes: 21 additions & 0 deletions spec/classes/init_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -270,5 +270,26 @@
it { should_not contain_package('gitlab-ce') }
it { should_not contain_package('gitlab-ee') }
end
describe 'with data_dirs' do
let(:params) do
{
'git_data_dirs' => {
'default' => '/var/opt/gitlab/data',
'alt' => '/opt/data'
}
}
end
it do
is_expected.to contain_file('/etc/gitlab/gitlab.rb')
.with_content(/^\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"})
end
end
end
end
10 changes: 9 additions & 1 deletion templates/gitlab.rb.erb
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,20 @@ external_url '<%= @external_url %>'
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
###! Docs: https://docs.gitlab.com/omnibus/settings/configuration.html#storing-git-data-in-an-alternative-directory
###! **If you want to use a single non-default directory to store git data use a
###! path that doesn't contain symlinks.**
git_data_dirs(<%= decorate(@git_data_dirs) %>)
<%- end -%>

<%- if @gitlab_rails -%>

############################
Expand Down