Browse Source

Install the package, and test that it happened.

Aaron Hicks 6 years ago
parent
commit
bea46d1f7a
4 changed files with 50 additions and 1 deletions
  1. 8
    1
      manifests/init.pp
  2. 7
    0
      manifests/install.pp
  3. 12
    0
      manifests/params.pp
  4. 23
    0
      spec/gpg_spec.rb

+ 8
- 1
manifests/init.pp View File

@@ -27,7 +27,14 @@
27 27
 #     along with the gpg Puppet module.  If not, see <http://www.gnu.org/licenses/>.
28 28
 
29 29
 # [Remember: No empty lines between comments and class definition]
30
-class gpg {
30
+class gpg (
31 31
 
32
+) inherits gpg::params {
33
+
34
+  # Parameter sanity checks here
35
+
36
+  class{'gpg::install':
37
+    package   => $gpg::params::package
38
+  }
32 39
 
33 40
 }

+ 7
- 0
manifests/install.pp View File

@@ -0,0 +1,7 @@
1
+class gpg::install (
2
+  $package
3
+){
4
+  package{$package:
5
+    ensure => installed
6
+  }
7
+}

+ 12
- 0
manifests/params.pp View File

@@ -0,0 +1,12 @@
1
+class "gpg::params" {
2
+
3
+case $::osfamily {
4
+  'Debian', 'RedHat':{
5
+    $package  = 'gnupg'
6
+  }
7
+  default {
8
+    fail("The operating system family ${::osfamily} is not supported by the puppet-gpg module on ${::fqdn}")
9
+  }
10
+}
11
+
12
+}

+ 23
- 0
spec/gpg_spec.rb View File

@@ -0,0 +1,23 @@
1
+require 'spec_helper'
2
+
3
+describe 'gpg', :type => :class do
4
+  context "on a Debian OS" do
5
+    let :facts do
6
+      {
7
+        :osfamily   => 'Debian'
8
+      }
9
+    end
10
+    it { should include_class("gpg::params") }
11
+    it { should contain_package("gnupg") }
12
+  end
13
+
14
+  context "on a RedHat OS" do
15
+    let :facts do
16
+      {
17
+        :osfamily   => 'RedHat'
18
+      }
19
+    end
20
+    it { should include_class("gpg::params") }
21
+    it { should contain_package("gnupg") }
22
+  end
23
+end

Loading…
Cancel
Save