mirror of
https://github.com/krislamo/puppet-rsnapshot
synced 2025-04-10 16:24:21 +00:00
Compare commits
28 Commits
Author | SHA1 | Date | |
---|---|---|---|
512130b0d8 | |||
f3cd595a8f | |||
|
03c31b78c2 | ||
|
679c742fd3 | ||
|
9327c68d59 | ||
|
b72f1dfb36 | ||
|
4820ededfa | ||
|
c7e02c53dd | ||
|
43cd819749 | ||
|
ab20bea159 | ||
|
8aba7d0782 | ||
|
a774e8b360 | ||
|
02b61e2180 | ||
|
063df85094 | ||
|
765ed614b7 | ||
|
94b890df6d | ||
|
a2dfd903c3 | ||
|
3ae826a0e0 | ||
|
efa6ef8808 | ||
|
e1f5fa7ebe | ||
|
2590264764 | ||
|
165bcd0766 | ||
|
434afe708b | ||
|
395efceea9 | ||
|
8f25dab414 | ||
|
4d810759ac | ||
|
1a68a16c79 | ||
|
8fb1b403e0 |
1
.gitignore
vendored
1
.gitignore
vendored
@ -2,3 +2,4 @@
|
|||||||
Gemfile.lock
|
Gemfile.lock
|
||||||
pkg/
|
pkg/
|
||||||
vendor/
|
vendor/
|
||||||
|
log/
|
13
.travis.yml
13
.travis.yml
@ -2,13 +2,20 @@
|
|||||||
sudo: false
|
sudo: false
|
||||||
language: ruby
|
language: ruby
|
||||||
cache: bundler
|
cache: bundler
|
||||||
bundler_args: --without system_tests
|
|
||||||
script: "bundle exec rake validate && bundle exec rake spec SPEC_OPTS='--format documentation'"
|
|
||||||
matrix:
|
matrix:
|
||||||
fast_finish: true
|
fast_finish: true
|
||||||
include:
|
include:
|
||||||
rvm: 2.1
|
- rvm: 2.1
|
||||||
env: PUPPET_GEM_VERSION="~> 4.0"
|
env: PUPPET_GEM_VERSION="~> 4.0"
|
||||||
|
script: "bundle exec rake validate"
|
||||||
|
- rvm: 2.1
|
||||||
|
env: PUPPET_GEM_VERSION="~> 4.0"
|
||||||
|
script: "bundle exec rake spec SPEC_OPTS='--format documentation'"
|
||||||
|
- rvm: 2.1
|
||||||
|
env: PUPPET_GEM_VERSION="~> 4.0"
|
||||||
|
script: "bundle exec rake beaker"
|
||||||
|
services: docker
|
||||||
|
sudo: required
|
||||||
notifications:
|
notifications:
|
||||||
email: false
|
email: false
|
||||||
|
|
||||||
|
6
Gemfile
6
Gemfile
@ -6,3 +6,9 @@ gem 'puppetlabs_spec_helper', '>= 0.8.2'
|
|||||||
gem 'puppet-lint', '>= 1.0.0'
|
gem 'puppet-lint', '>= 1.0.0'
|
||||||
gem 'facter', '>= 1.7.0'
|
gem 'facter', '>= 1.7.0'
|
||||||
gem 'metadata-json-lint'
|
gem 'metadata-json-lint'
|
||||||
|
|
||||||
|
group :acceptance do
|
||||||
|
gem 'beaker-rspec', '5.6.0'
|
||||||
|
gem 'serverspec', require: false
|
||||||
|
gem 'specinfra', require: false
|
||||||
|
end
|
||||||
|
@ -329,7 +329,7 @@ Default is:
|
|||||||
monthly => {
|
monthly => {
|
||||||
minute => '0..59',
|
minute => '0..59',
|
||||||
hour => '0..23', # you could also do: ['21..23','0..4','5'],
|
hour => '0..23', # you could also do: ['21..23','0..4','5'],
|
||||||
monthday => '0..28',
|
monthday => '1..28',
|
||||||
month => '*',
|
month => '*',
|
||||||
weekday => '*',
|
weekday => '*',
|
||||||
},
|
},
|
||||||
|
@ -103,6 +103,7 @@ class rsnapshot::config (
|
|||||||
if ! ( $interval and $retain ) {
|
if ! ( $interval and $retain ) {
|
||||||
$interval = pick($hash['interval'], $rsnapshot::params::config_interval)
|
$interval = pick($hash['interval'], $rsnapshot::params::config_interval)
|
||||||
}
|
}
|
||||||
|
|
||||||
# rsnapshot wants numeric values
|
# rsnapshot wants numeric values
|
||||||
if $link_dest {
|
if $link_dest {
|
||||||
$link_dest_num = bool2num($link_dest)
|
$link_dest_num = bool2num($link_dest)
|
||||||
@ -113,6 +114,9 @@ class rsnapshot::config (
|
|||||||
if $use_lazy_deletes {
|
if $use_lazy_deletes {
|
||||||
$use_lazy_deletes_num = bool2num($use_lazy_deletes)
|
$use_lazy_deletes_num = bool2num($use_lazy_deletes)
|
||||||
}
|
}
|
||||||
|
if $one_fs {
|
||||||
|
$one_fs_num = bool2num($one_fs)
|
||||||
|
}
|
||||||
|
|
||||||
$real_include = $rsnapshot::include + $include
|
$real_include = $rsnapshot::include + $include
|
||||||
unless empty($real_include) {
|
unless empty($real_include) {
|
||||||
|
@ -10,5 +10,18 @@ class rsnapshot::install {
|
|||||||
ensure => $rsnapshot::package_ensure,
|
ensure => $rsnapshot::package_ensure,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# ensure run directory exists (systemd clears /var/run, so rsnapshot can't create PID files after reboot - issue#12)
|
||||||
|
$lockpath = pick($rsnapshot::lockpath, $rsnapshot::params::config_lockpath, '/var/run/rsnapshot')
|
||||||
|
$tmpfiles_d = '/etc/tmpfiles.d'
|
||||||
|
|
||||||
|
file { "${tmpfiles_d}":
|
||||||
|
ensure => directory,
|
||||||
|
}
|
||||||
|
|
||||||
|
file { "${tmpfiles_d}/rsnapshot.conf":
|
||||||
|
ensure => present,
|
||||||
|
content => "D ${lockpath} 0755 root root -",
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -96,7 +96,7 @@ class rsnapshot::params {
|
|||||||
monthly => {
|
monthly => {
|
||||||
minute => '0..59',
|
minute => '0..59',
|
||||||
hour => '0..23', # you could also do: ['21..23','0..4','5'],
|
hour => '0..23', # you could also do: ['21..23','0..4','5'],
|
||||||
monthday => '0..28',
|
monthday => '1..28',
|
||||||
month => '*',
|
month => '*',
|
||||||
weekday => '*',
|
weekday => '*',
|
||||||
},
|
},
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "loomsen-rsnapshot",
|
"name": "loomsen-rsnapshot",
|
||||||
"version": "1.2.1",
|
"version": "1.2.5",
|
||||||
"author": "loomsen",
|
"author": "loomsen",
|
||||||
"summary": "Configures rsnapshot.",
|
"summary": "Configures rsnapshot.",
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
@ -28,11 +28,11 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"operatingsystem": "Ubuntu",
|
"operatingsystem": "Ubuntu",
|
||||||
"operatingsystemrelease": [ "12.04", "10.04", "14.04" ]
|
"operatingsystemrelease": [ "12.04", "12.10", "13.04", "13.10", "14.04", "14.10", "15.04", "15.10", "16.04", "16.10", "17.04" ]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"operatingsystem": "Fedora",
|
"operatingsystem": "Fedora",
|
||||||
"operatingsystemrelease": [ "17", "18", "19", "20", "21", "22", "23", "24" ]
|
"operatingsystemrelease": [ "17", "18", "19", "20", "21", "22", "23", "24", "25" ]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
63
spec/acceptance/default_spec.rb
Normal file
63
spec/acceptance/default_spec.rb
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
require 'spec_helper_acceptance'
|
||||||
|
|
||||||
|
describe 'rsnapshot' do
|
||||||
|
context 'with defaults' do
|
||||||
|
it 'run idempotently' do
|
||||||
|
pp = <<-EOS
|
||||||
|
class { 'rsnapshot':
|
||||||
|
hosts => {
|
||||||
|
'localhost' => {},
|
||||||
|
'example.com' => {
|
||||||
|
backup_defaults => false,
|
||||||
|
backup => {
|
||||||
|
'/var/' => './'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
EOS
|
||||||
|
|
||||||
|
apply_manifest(pp, catch_failures: true)
|
||||||
|
apply_manifest(pp, catch_changes: true)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'packages installed' do
|
||||||
|
describe package('rsnapshot') do
|
||||||
|
it { is_expected.to be_installed }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
context 'files provisioned' do
|
||||||
|
describe file('/etc/tmpfiles.d') do
|
||||||
|
it { should be_directory }
|
||||||
|
end
|
||||||
|
describe file('/etc/tmpfiles.d/rsnapshot.conf') do
|
||||||
|
it { is_expected.to exist }
|
||||||
|
its(:content) { is_expected.to match 'D /var/run/rsnapshot 0755 root root -' }
|
||||||
|
end
|
||||||
|
describe file('/var/run/rsnapshot') do
|
||||||
|
it { should be_directory }
|
||||||
|
end
|
||||||
|
describe file('/etc/rsnapshot/localhost.rsnapshot.conf') do
|
||||||
|
it { is_expected.to exist }
|
||||||
|
its(:content) { is_expected.to match 'backup' }
|
||||||
|
end
|
||||||
|
describe file('/etc/rsnapshot/example.com.rsnapshot.conf') do
|
||||||
|
it { is_expected.to exist }
|
||||||
|
its(:content) { is_expected.to match 'backup\troot@example.com:/var/\t./' }
|
||||||
|
end
|
||||||
|
describe file('/etc/rsnapshot.conf') do
|
||||||
|
it { is_expected.to exist }
|
||||||
|
its(:content) { is_expected.to match 'localhost' }
|
||||||
|
its(:content) { is_expected.to match 'example.com' }
|
||||||
|
end
|
||||||
|
describe file('/etc/rsnapshot/localhost.rsnapshot.conf') do
|
||||||
|
it { is_expected.to exist }
|
||||||
|
its(:content) { is_expected.to match 'backup' }
|
||||||
|
end
|
||||||
|
describe file('/etc/cron.d/example_com') do
|
||||||
|
it { is_expected.to exist }
|
||||||
|
its(:content) { is_expected.to match 'example.com' }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
15
spec/acceptance/nodesets/default.yml
Normal file
15
spec/acceptance/nodesets/default.yml
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
HOSTS:
|
||||||
|
debian-8-x64:
|
||||||
|
platform: debian-8-amd64
|
||||||
|
hypervisor: docker
|
||||||
|
image: debian:8
|
||||||
|
docker_container_name: puppet_rsnapshot
|
||||||
|
docker_preserve_image: true
|
||||||
|
docker_cmd: '["/sbin/init"]'
|
||||||
|
docker_image_commands:
|
||||||
|
- 'echo deb http://ftp.debian.org/debian jessie-backports main >> /etc/apt/sources.list'
|
||||||
|
- 'apt-get update && apt-get install -y cron locales-all net-tools wget'
|
||||||
|
- 'rm -f /usr/sbin/policy-rc.d'
|
||||||
|
CONFIG:
|
||||||
|
trace_limit: 200
|
||||||
|
masterless: true
|
26
spec/spec_helper_acceptance.rb
Normal file
26
spec/spec_helper_acceptance.rb
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
require 'puppet'
|
||||||
|
require 'beaker-rspec'
|
||||||
|
require 'yaml'
|
||||||
|
|
||||||
|
install_puppet_agent_on hosts, {}
|
||||||
|
|
||||||
|
RSpec.configure do |c|
|
||||||
|
# Module root and settings
|
||||||
|
module_root = File.expand_path(File.join(File.dirname(__FILE__), '..'))
|
||||||
|
module_name = module_root.split('/').last.sub('-', '_').split('_').last()
|
||||||
|
|
||||||
|
c.formatter = :documentation
|
||||||
|
c.max_displayed_failure_line_count = 5
|
||||||
|
|
||||||
|
c.before :suite do
|
||||||
|
puts 'Install module'
|
||||||
|
puppet_module_install(source: module_root, module_name: module_name)
|
||||||
|
|
||||||
|
hosts.each do |host|
|
||||||
|
puts 'Install fixtures'
|
||||||
|
on host, puppet('module','install','stahnma/epel')
|
||||||
|
on host, puppet('module','install','puppetlabs/stdlib')
|
||||||
|
on host, puppet('module','install','puppetlabs/concat')
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
Loading…
x
Reference in New Issue
Block a user