Added travis infrastructure and first tests
diff --git a/.fixtures.yml b/.fixtures.yml
new file mode 100644
index 0000000..4e81da2
--- /dev/null
+++ b/.fixtures.yml
@@ -0,0 +1,5 @@
+fixtures:
+ symlinks:
+ "backuppc": "#{source_dir}"
+ repositories:
+ "stdlib": "git://github.com/puppetlabs/puppetlabs-stdlib.git"
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..55bba1c
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,5 @@
+pkg/
+metadata.json
+Gemfile.lock
+.rspec_system/
+.*.sw*
diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 0000000..6c2c82a
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,29 @@
+rvm:
+ - 1.8.7
+ - 1.9.3
+ - 2.0.0
+
+script: "bundle exec rake spec"
+
+env:
+ matrix:
+ - PUPPET_GEM_VERSION="~> 2.7.0"
+ - PUPPET_GEM_VERSION="~> 3.0.0"
+ - PUPPET_GEM_VERSION="~> 3.1.0"
+ - PUPPET_GEM_VERSION="~> 3.2.0"
+ - PUPPET_GEM_VERSION="~> 3.3.0"
+
+matrix:
+ exclude:
+ - rvm: 1.9.3
+ env: PUPPET_GEM_VERSION="~> 2.7.0"
+ - rvm: 2.0.0
+ env: PUPPET_GEM_VERSION="~> 2.7.0"
+ - rvm: 2.0.0
+ env: PUPPET_GEM_VERSION="~> 3.0.0"
+ - rvm: 2.0.0
+ env: PUPPET_GEM_VERSION="~> 3.1.0"
+ - rvm: 1.8.7
+ env: PUPPET_GEM_VERSION="~> 3.2.0"
+ - rvm: 1.8.7
+ env: PUPPET_GEM_VERSION="~> 3.3.0"
diff --git a/Gemfile b/Gemfile
new file mode 100644
index 0000000..7c8ea9e
--- /dev/null
+++ b/Gemfile
@@ -0,0 +1,26 @@
+source 'https://rubygems.org'
+
+group :development, :test do
+ gem 'rake', :require => false
+ gem 'rspec-puppet', :require => false
+ gem 'puppetlabs_spec_helper', :require => false
+ gem 'serverspec', :require => false
+ gem 'rspec-system', :require => false
+ gem 'rspec-system-puppet', :require => false
+ gem 'rspec-system-serverspec', :require => false
+ gem 'puppet-lint', :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
diff --git a/README.md b/README.md
index 325b45f..2e9b1aa 100644
--- a/README.md
+++ b/README.md
@@ -98,6 +98,7 @@
* Storeconfigs need to be enabled for this module to work.
* There is a TODO for generating and installing the server's ssh key. Currently it relies on a facter value that is only present on the second run of puppet.
* Since Puppet does not support HOPing a process, backuppc will be restarted each time the master configuration changes. This causes active tasks to be stopped.
+<<<<<<< HEAD
## Contributors
* [txaj](https://github.com/txaj)
diff --git a/Rakefile b/Rakefile
new file mode 100644
index 0000000..cd3d379
--- /dev/null
+++ b/Rakefile
@@ -0,0 +1 @@
+require 'puppetlabs_spec_helper/rake_tasks'
diff --git a/manifests/client.pp b/manifests/client.pp
index 3e22d8a..5caf424 100644
--- a/manifests/client.pp
+++ b/manifests/client.pp
@@ -57,6 +57,9 @@
# Maximum latency between backuppc server and client to schedule
# a backup. Default to 20ms.
#
+# Maximum latency between backuppc server and client to schedule
+# a backup. Default to 20ms.
+#
# [*backups_disable*]
# Disable all full and incremental backups. These settings are useful for a client that
# is no longer being backed up (eg: a retired machine), but you wish to keep the last backups
@@ -343,7 +346,7 @@
owner => 'root',
group => 'root',
mode => '0440',
- content => "${system_account} ALL=(ALL:ALL) NOPASSWD: ${sudo_commands}\n",
+ content => "${system_account} ALL=(ALL:ALL) NOEXEC:NOPASSWD: ${sudo_commands_noexec}\n",
}
case $::osfamily {
diff --git a/spec/classes/backuppc_client_spec.rb b/spec/classes/backuppc_client_spec.rb
new file mode 100644
index 0000000..9345e7c
--- /dev/null
+++ b/spec/classes/backuppc_client_spec.rb
@@ -0,0 +1,25 @@
+require 'spec_helper'
+
+describe 'backuppc::client', :type => :class do
+
+ describe 'On an unknown operating system' do
+ let(:facts) {{ :osfamily => 'Unknown' }}
+ it "should fail" do
+ expect do
+ subject
+ end.to raise_error(Puppet::Error, /support/)
+ end
+ end
+
+ context "On Ubuntu" do
+ let(:facts) {{ :osfamily => 'Debian' }}
+ let(:params) {{ :backuppc_hostname => 'backuppc.test.com' }}
+ it { should include_class("backuppc::params") }
+ end
+
+ context "On RedHat" do
+ let(:facts) {{ :osfamily => 'RedHat' }}
+ let(:params) {{ :backuppc_hostname => 'backuppc.test.com' }}
+ it { should include_class("backuppc::params") }
+ end
+end
diff --git a/spec/classes/backuppc_server_spec.rb b/spec/classes/backuppc_server_spec.rb
new file mode 100644
index 0000000..3ec9c41
--- /dev/null
+++ b/spec/classes/backuppc_server_spec.rb
@@ -0,0 +1,27 @@
+require 'spec_helper'
+
+describe 'backuppc::server', :type => :class do
+
+ describe 'On an unknown operating system' do
+ let(:facts) {{ :osfamily => 'Unknown' }}
+ it "should fail" do
+ expect do
+ subject
+ end.to raise_error(Puppet::Error, /is not supported by this module/)
+ end
+ end
+
+ context "On Ubuntu" do
+ let(:facts) {{ :osfamily => 'Debian' }}
+ let(:params) {{ :backuppc_password => 'test_password' }}
+ it { should include_class("backuppc::params") }
+ it { should contain_package('backuppc') }
+ end
+
+ context "On RedHat" do
+ let(:facts) {{ :osfamily => 'RedHat' }}
+ let(:params) {{ :backuppc_password => 'test_password' }}
+ it { should include_class("backuppc::params") }
+ it { should contain_package('BackupPC') }
+ end
+end
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
new file mode 100644
index 0000000..2c6f566
--- /dev/null
+++ b/spec/spec_helper.rb
@@ -0,0 +1 @@
+require 'puppetlabs_spec_helper/module_spec_helper'