Commit 15747c8a authored by Matthieu Vachon's avatar Matthieu Vachon Committed by Matthieu Vachon

Added possibility to disabled gitlab backup cron task installation

parent 02b4634c
......@@ -269,6 +269,7 @@ default['gitlab']['monitrc']['emergency_email'] = nil
default['gitlab']['monitrc']['emergency_events'] = ['timeout']
# backups
default['gitlab']['backup']['enable'] = true
default['gitlab']['backup']['cron']['action'] = :create
default['gitlab']['backup']['cron']['minute'] = 0
default['gitlab']['backup']['cron']['hour'] = 2
......
......@@ -15,5 +15,5 @@ cron 'gitlab_backups' do
path node['gitlab']['backup']['cron']['path']
command "cd #{gitlab['home']}/gitlab && bundle exec rake gitlab:backup:create RAILS_ENV=#{gitlab['env']}"
only_if { gitlab['env'] == 'production' }
only_if { gitlab['backup']['enable'] and gitlab['env'] == 'production' }
end
......@@ -22,6 +22,18 @@ describe "gitlab::backup" do
path: '/usr/local/bin:/usr/bin:/bin')
end
describe "when backup disabled" do
let(:chef_run) do
runner = ChefSpec::Runner.new(platform: "ubuntu", version: version)
runner.node.set['gitlab']['backup']['enable'] = false
runner.converge("gitlab::backup")
end
it "does not create a cron job" do
expect(chef_run).to_not create_cron('gitlab_backups')
end
end
describe "when in development environment" do
let(:chef_run) do
runner = ChefSpec::Runner.new(platform: "ubuntu", version: version)
......@@ -53,6 +65,18 @@ describe "gitlab::backup" do
path: '/usr/local/bin:/usr/bin:/bin')
end
describe "when backup disabled" do
let(:chef_run) do
runner = ChefSpec::Runner.new(platform: "centos", version: version)
runner.node.set['gitlab']['backup']['enable'] = false
runner.converge("gitlab::backup")
end
it "does not create a cron job" do
expect(chef_run).to_not create_cron('gitlab_backups')
end
end
describe "when in development environment" do
let(:chef_run) do
runner = ChefSpec::Runner.new(platform: "centos", version: version)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment