Skip to content

Commit

Permalink
Use puppetlabs/stdlib to validate inputs.
Browse files Browse the repository at this point in the history
  • Loading branch information
razorsedge authored and Joshua Hoblitt committed Aug 17, 2013
1 parent fb78b8b commit d78077b
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .fixtures.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
fixtures:
repositories:
# "stdlib": "git://github.com/puppetlabs/puppetlabs-stdlib.git"
"stdlib": "git://github.com/puppetlabs/puppetlabs-stdlib.git"
"shell_config": "http://tig.csail.mit.edu/git-public/shell_config.git/"
symlinks:
"smartd": "#{source_dir}"
1 change: 1 addition & 0 deletions Modulefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ for detecting and identifying disks hiding behind an LSI MegaRAID/Dell PERC
RAID controller (currently only implemented for Linux).'
project_page 'http://tig.csail.mit.edu/wiki/TIG/PuppetAtCSAIL'
dependency 'csail/shell_config', '>= 0.0.1'
dependency 'puppetlabs/stdlib', '>=2.3.0'
13 changes: 13 additions & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,19 @@
$warning_schedule = $smartd::params::warning_schedule,
$enable_monit = $smartd::params::enable_monit,
) inherits smartd::params {
# Validate our booleans
validate_bool($autoupdate)
validate_bool($devicescan)
validate_bool($enable_monit)

# Validate our hashs
validate_hash($device_opts)

# Validate our regexs
$states = [ '^daily$', '^once$', '^diminishing$', ]
validate_re($warning_schedule, $states,
'$warning_schedule must be either daily, once, or diminishing.')

case $ensure {
'present': {
if $autoupdate {
Expand Down

0 comments on commit d78077b

Please sign in to comment.