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
|
||||
gem 'rspec-core', '~> 3.1.7', :require => false
|
||||
gem 'rspec-puppet', '~> 2.1', :require => false
|
||||
gem 'puppetlabs_spec_helper', :require => false
|
||||
gem 'simplecov', :require => false
|
||||
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
|
||||
puppetversion = ENV.key?('PUPPET_VERSION') ? "#{ENV['PUPPET_VERSION']}" : ['>= 4.0']
|
||||
gem 'puppet', puppetversion
|
||||
gem 'puppetlabs_spec_helper', '>= 0.8.2'
|
||||
gem 'puppet-lint', '>= 1.0.0'
|
||||
gem 'facter', '>= 1.7.0'
|
||||
|
@ -7,9 +7,9 @@ class rsnapshot::config (
|
||||
) {
|
||||
# these are global settings, no point in setting them per host
|
||||
$config_version = $rsnapshot::params::config_version
|
||||
$lockpath = pick($rsnapshot::lockpath, $rsnapshot::params::config_lockpath)
|
||||
$conf_d = pick($rsnapshot::conf_d, $rsnapshot::params::conf_d)
|
||||
$snapshot_root = pick($hosts['snapshot_root'], $rsnapshot::params::config_snapshot_root)
|
||||
$lockpath = pick($rsnapshot::lockpath, $rsnapshot::params::config_lockpath, '/var/run/rsnapshot')
|
||||
$conf_d = pick($rsnapshot::conf_d, $rsnapshot::params::conf_d, '/etc/rsnapshot')
|
||||
$snapshot_root = pick($hosts['snapshot_root'], $rsnapshot::params::config_snapshot_root, '/backup')
|
||||
$default_cron = assert_empty_hash($::rsnapshot::cron)
|
||||
# make sure lock path and conf path exist
|
||||
file { $conf_d:
|
||||
|
@ -14,7 +14,7 @@ class rsnapshot (
|
||||
$package_ensure = $rsnapshot::params::package_ensure,
|
||||
$cron = $rsnapshot::params::cron,
|
||||
) inherits rsnapshot::params {
|
||||
if $::puppetversion =~ /^(1|2|3)/ {
|
||||
if $puppetversion =~ /^(1|2|3)/ {
|
||||
fail('This module requires Puppet 4')
|
||||
}
|
||||
if $hosts {
|
||||
|
@ -1,7 +1,7 @@
|
||||
# == Class: rsnapshot::install
|
||||
#
|
||||
# Installs the rsnapshot package.
|
||||
class rsnapshot::install inherits rsnapshot {
|
||||
class rsnapshot::install {
|
||||
case $::operatingsystem {
|
||||
/^CentOS$/: { include epel }
|
||||
default: {}
|
||||
|
@ -1,37 +1,7 @@
|
||||
require 'spec_helper'
|
||||
describe 'rsnapshot' do
|
||||
|
||||
{'Ubuntu' => 'Debian', 'Debian' => 'Debian'}.each do |system, family|
|
||||
context "when on system #{system} no lvm" do
|
||||
let :facts do
|
||||
{
|
||||
: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
|
||||
it { should contain_class('rsnapshot::params') }
|
||||
it { is_expected.to compile }
|
||||
it { is_expected.to contain_class('rsnapshot::config') }
|
||||
it { is_expected.to contain_class('rsnapshot::install') }
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user