From: Tom Hughes Date: Sun, 23 Feb 2020 19:22:00 +0000 (+0000) Subject: Add test for backup cookbook X-Git-Url: https://git.openstreetmap.org/chef.git/commitdiff_plain/2d364c50c30dae156acdab6d612dac184cba57f1?hp=c783d0a11851850072bcd05d6c87afab99fda211;ds=sidebyside Add test for backup cookbook --- diff --git a/.github/workflows/test-kitchen.yml b/.github/workflows/test-kitchen.yml index 2566c414c..6646f28d0 100644 --- a/.github/workflows/test-kitchen.yml +++ b/.github/workflows/test-kitchen.yml @@ -12,6 +12,7 @@ jobs: - accounts - apache - apt + - backup - bind - blog - blogs diff --git a/.kitchen.yml b/.kitchen.yml index df5f78b82..babf14107 100644 --- a/.kitchen.yml +++ b/.kitchen.yml @@ -33,6 +33,9 @@ suites: - name: apt run_list: - recipe[apt::default] + - name: backup + run_list: + - recipe[backup::default] - name: bind run_list: - recipe[bind::default] diff --git a/cookbooks/backup/attributes/default.rb b/cookbooks/backup/attributes/default.rb index c0b8de57f..2773238ab 100644 --- a/cookbooks/backup/attributes/default.rb +++ b/cookbooks/backup/attributes/default.rb @@ -1 +1,3 @@ default[:stats][:sites] = [] + +default[:accounts][:users][:osmbackup][:status] = :role diff --git a/cookbooks/backup/metadata.rb b/cookbooks/backup/metadata.rb index c4f1bdabd..d5baa1664 100644 --- a/cookbooks/backup/metadata.rb +++ b/cookbooks/backup/metadata.rb @@ -6,3 +6,4 @@ description "Installs and configures backup.openstreetmap.org" version "1.0.0" supports "ubuntu" +depends "accounts" diff --git a/cookbooks/backup/recipes/default.rb b/cookbooks/backup/recipes/default.rb index 0204f56f2..794f8e51e 100644 --- a/cookbooks/backup/recipes/default.rb +++ b/cookbooks/backup/recipes/default.rb @@ -17,6 +17,8 @@ # limitations under the License. # +include_recipe "accounts" + package %w[ perl libdate-calc-perl @@ -26,6 +28,7 @@ directory "/store/backup" do owner "osmbackup" group "osmbackup" mode 0o2755 + recursive true end cookbook_file "/usr/local/bin/expire-backups" do diff --git a/roles/backup.rb b/roles/backup.rb index b0c519bd8..d08483d1c 100644 --- a/roles/backup.rb +++ b/roles/backup.rb @@ -2,11 +2,6 @@ name "backup" description "Role applied to backup.openstreetmap.org" default_attributes( - :accounts => { - :users => { - :osmbackup => { :status => :role } - } - }, :rsyncd => { :modules => { :backup => { diff --git a/test/data_bags/accounts/osmbackup.json b/test/data_bags/accounts/osmbackup.json new file mode 100644 index 000000000..2fcfd71b4 --- /dev/null +++ b/test/data_bags/accounts/osmbackup.json @@ -0,0 +1,7 @@ +{ + "id": "osmbackup", + "uid": 501, + "comment": "Backups", + "home": "/store/backup", + "manage_home": false +}