Skip to content

Commit

Permalink
add udev package installation support
Browse files Browse the repository at this point in the history
  • Loading branch information
Joshua Hoblitt committed Sep 19, 2013
1 parent 738cea0 commit b6821fe
Show file tree
Hide file tree
Showing 5 changed files with 62 additions and 6 deletions.
19 changes: 16 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Puppet module_skel Module
Puppet udev Module
=========================

[![Build Status](https://travis-ci.org/jhoblitt/puppet-module_skel.png)](https://travis-ci.org/jhoblitt/puppet-module_skel)
[![Build Status](https://travis-ci.org/jhoblitt/puppet-udev.png)](https://travis-ci.org/jhoblitt/puppet-udev)

#### Table of Contents

Expand All @@ -16,24 +16,37 @@ Puppet module_skel Module
Overview
--------

Manages the udev package


Description
-----------

This module installs and manages the
[`udev`](http://www.freedesktop.org/software/systemd/man/udev.html) package.

Usage
-----

```puppet
include udev
```


Limitations
-----------

At present, only support for `$::osfamily == 'RedHat'` has been implimented.
Adding other Linux distrubtions should be trivial.

### Tested Platforms

* el6.x


Support
-------

Please log tickets and issues at
[github](https://github.com/jhoblitt/puppet-module_skel/issues)
[github](https://github.com/jhoblitt/puppet-udev/issues)

6 changes: 4 additions & 2 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
#
# simple template
#
class udev {

class udev inherits udev::params {
package{ $udev::params::udev_package:
ensure => present,
}
}
14 changes: 14 additions & 0 deletions manifests/params.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# == Class: udev::params
#
# This class should be considered private.
#
class udev::params {
$udev_package = 'udev'

case $::osfamily {
'redhat': {}
default: {
fail("Module ${module_name} is not supported on ${::operatingsystem}")
}
}
}
24 changes: 24 additions & 0 deletions spec/classes/params_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
require 'spec_helper'

describe 'udev::params', :type => :class do
describe 'for osfamily RedHat' do
let(:facts) {{ :osfamily => 'RedHat' }}

it { should include_class('udev::params') }
end

describe 'unsupported osfamily' do
let :facts do
{
:osfamily => 'Debian',
:operatingsystem => 'Debian',
}
end

it 'should fail' do
expect { should include_class('udev::params') }.
to raise_error(Puppet::Error, /not supported on Debian/)
end
end

end
5 changes: 4 additions & 1 deletion spec/classes/udev_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@
describe 'udev', :type => :class do

describe 'for osfamily RedHat' do
it { should contain_class('udev') }
let(:facts) {{ :osfamily => 'RedHat' }}

it { should include_class('udev') }
it { should contain_package('udev').with_ensure(:present) }
end

end

0 comments on commit b6821fe

Please sign in to comment.