-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Joshua Hoblitt
committed
Sep 20, 2013
1 parent
db481ed
commit fedd155
Showing
6 changed files
with
160 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# == Class: udev::udevadm::logpriority | ||
# | ||
# Set the udev daemon runtime log level. | ||
# | ||
# This class does nothing unless it receives a *notify* message. | ||
# | ||
# === Parameters | ||
# | ||
# [*udev_log*] | ||
# | ||
# String. Possible values: 'err, 'info', 'debug' | ||
# | ||
# Default: 'err' | ||
# | ||
# | ||
# === Examples | ||
# | ||
# class { 'udev::udevadm::logpriority': udev_log => 'debug' } | ||
# | ||
# | ||
class udev::udevadm::logpriority( | ||
$udev_log = 'err', | ||
) inherits udev::params { | ||
validate_re($udev_log, '^err$|^info$|^debug$') | ||
|
||
exec { "udevadm control --log-priority=${udev_log}": | ||
refreshonly => true, | ||
path => [$udev::params::udevadm_path], | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
require 'spec_helper' | ||
|
||
describe 'udev::udevadm::logpriority', :type => :class do | ||
|
||
shared_examples 'udev_log_param' do |udev_log, params| | ||
let(:params) { params } | ||
|
||
it do | ||
should contain_class('udev::udevadm::logpriority'). | ||
with_udev_log(udev_log) | ||
should contain_exec("udevadm control --log-priority=#{udev_log}").with({ | ||
:refreshonly => true, | ||
:path => '/sbin', | ||
}) | ||
end | ||
end | ||
|
||
describe 'for osfamily RedHat' do | ||
let(:facts) {{ :osfamily => 'RedHat' }} | ||
|
||
describe 'no params' do | ||
it_behaves_like('udev_log_param', 'err', {}) | ||
end | ||
|
||
describe 'udev_log => err' do | ||
it_behaves_like('udev_log_param', 'err', { :udev_log => 'err' }) | ||
end | ||
|
||
describe 'udev_log => info' do | ||
it_behaves_like('udev_log_param', 'info', { :udev_log => 'info' }) | ||
end | ||
|
||
describe 'udev_log => debug' do | ||
it_behaves_like('udev_log_param', 'debug', { :udev_log => 'debug' }) | ||
end | ||
|
||
describe 'udev_log => invalid' do | ||
let(:params) {{ :udev_log => 'invalid' }} | ||
|
||
it 'should fail' do | ||
expect { | ||
should include_class('udev::udevadm::logpriority') | ||
}.to raise_error(Puppet::Error, /does not match/) | ||
end | ||
end | ||
|
||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# The initial syslog(3) priority: "err", "info", "debug" or its | ||
# numerical equivalent. For runtime debugging, the daemons internal | ||
# state can be changed with: "udevadm control --log-priority=<value>". | ||
udev_log="<%= udev_log %>" |