Chad has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/341371 )

Change subject: WIP: Create hourly backup schedule, modeled on weekly
......................................................................

WIP: Create hourly backup schedule, modeled on weekly

Todo:
- runs definition needs tweaking, haven't quite sorted the syntax
- actually use this for gerrit backups

Change-Id: I2d6dd6cddb116b7f1c4383db31900d69735fa574
---
A modules/backup/manifests/hourlyschedule.pp
A modules/backup/spec/defines/hourlyschedule_spec.rb
M modules/role/manifests/backup/director.pp
3 files changed, 44 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/operations/puppet 
refs/changes/71/341371/1

diff --git a/modules/backup/manifests/hourlyschedule.pp 
b/modules/backup/manifests/hourlyschedule.pp
new file mode 100644
index 0000000..1fd667f
--- /dev/null
+++ b/modules/backup/manifests/hourlyschedule.pp
@@ -0,0 +1,17 @@
+# Same for hourly backups
+define backup::hourlyschedule($pool) {
+    bacula::director::schedule { "Hourly-${name}":
+        # lint:ignore:arrow_alignment
+        runs => [
+            { 'level' => 'Full',
+              'at'    => "${name} at 02:05",
+            },
+                ],
+        # lint:endignore
+    }
+
+    bacula::director::jobdefaults { "Hourly-${name}-${pool}":
+        when => "Hourly-${name}",
+        pool => $pool,
+    }
+}
diff --git a/modules/backup/spec/defines/hourlyschedule_spec.rb 
b/modules/backup/spec/defines/hourlyschedule_spec.rb
new file mode 100644
index 0000000..ecf94fa
--- /dev/null
+++ b/modules/backup/spec/defines/hourlyschedule_spec.rb
@@ -0,0 +1,24 @@
+require 'spec_helper'
+
+describe 'backup::hourlyschedule', :type => :define do
+    let(:title) { 'something' }
+    let(:params) { {
+        :pool => 'unimportant',
+    }
+    }
+    let(:pre_condition) do
+       [
+            'define bacula::director::jobdefaults($when, $pool) {}',
+            'define bacula::director::schedule($runs) {}',
+       ]
+    end
+    it 'should create bacula::director::jobdefaults' do
+        should 
contain_bacula__director__jobdefaults("Hourly-#{title}-unimportant").with({
+            'when'    => "Hourly-#{title}",
+            'pool'    => 'unimportant',
+        })
+    end
+    it 'should create bacula::director::schedule' do
+        should contain_bacula__director__schedule("Hourly-#{title}")
+    end
+end
diff --git a/modules/role/manifests/backup/director.pp 
b/modules/role/manifests/backup/director.pp
index 60b8629..16e6dcc 100644
--- a/modules/role/manifests/backup/director.pp
+++ b/modules/role/manifests/backup/director.pp
@@ -59,6 +59,9 @@
     backup::weeklyschedule { $role::backup::config::days:
         pool    => $pool,
     }
+    backup::hourlyschedule { $role::backup::config::days:
+        pool    => $pool,
+    }
 
     bacula::director::catalog { 'production':
         dbname     => 'bacula',

-- 
To view, visit https://gerrit.wikimedia.org/r/341371
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I2d6dd6cddb116b7f1c4383db31900d69735fa574
Gerrit-PatchSet: 1
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Chad <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to