mirror of
https://github.com/krislamo/puppet-rsnapshot
synced 2024-12-16 09:40:35 +00:00
remove class inheritance in install.pp
This commit is contained in:
parent
abae53b1ad
commit
0b21f0e751
37
Gemfile
37
Gemfile
@ -1,32 +1,7 @@
|
|||||||
source ENV['GEM_SOURCE'] || 'https://rubygems.org'
|
source 'https://rubygems.org'
|
||||||
|
|
||||||
group :development, :unit_tests do
|
puppetversion = ENV.key?('PUPPET_VERSION') ? "#{ENV['PUPPET_VERSION']}" : ['>= 4.0']
|
||||||
gem 'rspec-core', '~> 3.1.7', :require => false
|
gem 'puppet', puppetversion
|
||||||
gem 'rspec-puppet', '~> 2.1', :require => false
|
gem 'puppetlabs_spec_helper', '>= 0.8.2'
|
||||||
gem 'puppetlabs_spec_helper', :require => false
|
gem 'puppet-lint', '>= 1.0.0'
|
||||||
gem 'simplecov', :require => false
|
gem 'facter', '>= 1.7.0'
|
||||||
gem 'puppet_facts', :require => false
|
|
||||||
gem 'json', :require => false
|
|
||||||
gem 'metadata-json-lint', :require => false
|
|
||||||
gem 'puppet-lint', '< 1.1.0', :require => false
|
|
||||||
end
|
|
||||||
|
|
||||||
group :system_tests do
|
|
||||||
gem 'beaker-rspec', :require => false
|
|
||||||
gem 'serverspec', :require => false
|
|
||||||
gem 'beaker-puppet_install_helper', :require => false
|
|
||||||
end
|
|
||||||
|
|
||||||
if facterversion = ENV['FACTER_GEM_VERSION']
|
|
||||||
gem 'facter', facterversion, :require => false
|
|
||||||
else
|
|
||||||
gem 'facter', :require => false
|
|
||||||
end
|
|
||||||
|
|
||||||
if puppetversion = ENV['PUPPET_GEM_VERSION']
|
|
||||||
gem 'puppet', puppetversion, :require => false
|
|
||||||
else
|
|
||||||
gem 'puppet', :require => false
|
|
||||||
end
|
|
||||||
|
|
||||||
# vim:ft=ruby
|
|
||||||
|
@ -7,9 +7,9 @@ class rsnapshot::config (
|
|||||||
) {
|
) {
|
||||||
# these are global settings, no point in setting them per host
|
# these are global settings, no point in setting them per host
|
||||||
$config_version = $rsnapshot::params::config_version
|
$config_version = $rsnapshot::params::config_version
|
||||||
$lockpath = pick($rsnapshot::lockpath, $rsnapshot::params::config_lockpath)
|
$lockpath = pick($rsnapshot::lockpath, $rsnapshot::params::config_lockpath, '/var/run/rsnapshot')
|
||||||
$conf_d = pick($rsnapshot::conf_d, $rsnapshot::params::conf_d)
|
$conf_d = pick($rsnapshot::conf_d, $rsnapshot::params::conf_d, '/etc/rsnapshot')
|
||||||
$snapshot_root = pick($hosts['snapshot_root'], $rsnapshot::params::config_snapshot_root)
|
$snapshot_root = pick($hosts['snapshot_root'], $rsnapshot::params::config_snapshot_root, '/backup')
|
||||||
$default_cron = assert_empty_hash($::rsnapshot::cron)
|
$default_cron = assert_empty_hash($::rsnapshot::cron)
|
||||||
# make sure lock path and conf path exist
|
# make sure lock path and conf path exist
|
||||||
file { $conf_d:
|
file { $conf_d:
|
||||||
|
@ -14,7 +14,7 @@ class rsnapshot (
|
|||||||
$package_ensure = $rsnapshot::params::package_ensure,
|
$package_ensure = $rsnapshot::params::package_ensure,
|
||||||
$cron = $rsnapshot::params::cron,
|
$cron = $rsnapshot::params::cron,
|
||||||
) inherits rsnapshot::params {
|
) inherits rsnapshot::params {
|
||||||
if $::puppetversion =~ /^(1|2|3)/ {
|
if $puppetversion =~ /^(1|2|3)/ {
|
||||||
fail('This module requires Puppet 4')
|
fail('This module requires Puppet 4')
|
||||||
}
|
}
|
||||||
if $hosts {
|
if $hosts {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
# == Class: rsnapshot::install
|
# == Class: rsnapshot::install
|
||||||
#
|
#
|
||||||
# Installs the rsnapshot package.
|
# Installs the rsnapshot package.
|
||||||
class rsnapshot::install inherits rsnapshot {
|
class rsnapshot::install {
|
||||||
case $::operatingsystem {
|
case $::operatingsystem {
|
||||||
/^CentOS$/: { include epel }
|
/^CentOS$/: { include epel }
|
||||||
default: {}
|
default: {}
|
||||||
|
@ -1,37 +1,7 @@
|
|||||||
require 'spec_helper'
|
require 'spec_helper'
|
||||||
describe 'rsnapshot' do
|
describe 'rsnapshot' do
|
||||||
|
it { should contain_class('rsnapshot::params') }
|
||||||
{'Ubuntu' => 'Debian', 'Debian' => 'Debian'}.each do |system, family|
|
it { is_expected.to compile }
|
||||||
context "when on system #{system} no lvm" do
|
it { is_expected.to contain_class('rsnapshot::config') }
|
||||||
let :facts do
|
it { is_expected.to contain_class('rsnapshot::install') }
|
||||||
{
|
|
||||||
:osfamily => family,
|
|
||||||
:operatingsystem => system,
|
|
||||||
}
|
|
||||||
end
|
|
||||||
|
|
||||||
it { should contain_class('rsnapshot') }
|
|
||||||
it { should contain_class('rsnapshot::install') }
|
|
||||||
it { should contain_class('rsnapshot::config') }
|
|
||||||
end
|
|
||||||
|
|
||||||
context "when on system #{system} with lvm" do
|
|
||||||
let :facts do
|
|
||||||
{
|
|
||||||
:osfamily => family,
|
|
||||||
:operatingsystem => system,
|
|
||||||
}
|
|
||||||
end
|
|
||||||
|
|
||||||
let(:params) { {:use_lvm => true} }
|
|
||||||
|
|
||||||
it { should contain_class('rsnapshot') }
|
|
||||||
it { should contain_class('rsnapshot::install') }
|
|
||||||
it { should contain_class('rsnapshot::config') }
|
|
||||||
|
|
||||||
it {
|
|
||||||
should contain_file('/etc/rsnapshot.conf').with_content(/^linux_lvm_((\w|_)+)\t(.*)$/)
|
|
||||||
}
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user