Browse Source

Install the package, and test that it happened.

master
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 @@
# along with the gpg Puppet module. If not, see <http://www.gnu.org/licenses/>.

# [Remember: No empty lines between comments and class definition]
class gpg {
class gpg (

) inherits gpg::params {

# Parameter sanity checks here

class{'gpg::install':
package => $gpg::params::package
}

}

+ 7
- 0
manifests/install.pp View File

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

+ 12
- 0
manifests/params.pp View File

@@ -0,0 +1,12 @@
class "gpg::params" {

case $::osfamily {
'Debian', 'RedHat':{
$package = 'gnupg'
}
default {
fail("The operating system family ${::osfamily} is not supported by the puppet-gpg module on ${::fqdn}")
}
}

}

+ 23
- 0
spec/gpg_spec.rb View File

@@ -0,0 +1,23 @@
require 'spec_helper'

describe 'gpg', :type => :class do
context "on a Debian OS" do
let :facts do
{
:osfamily => 'Debian'
}
end
it { should include_class("gpg::params") }
it { should contain_package("gnupg") }
end

context "on a RedHat OS" do
let :facts do
{
:osfamily => 'RedHat'
}
end
it { should include_class("gpg::params") }
it { should contain_package("gnupg") }
end
end

Loading…
Cancel
Save