Skip to content

Commit

Permalink
validate all class smartd params
Browse files Browse the repository at this point in the history
  • Loading branch information
Joshua Hoblitt committed Sep 14, 2013
1 parent cede61e commit 4c0ef6e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 10 deletions.
2 changes: 1 addition & 1 deletion Modulefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +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'
dependency 'puppetlabs/stdlib', '>=4.1.0'
14 changes: 6 additions & 8 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -113,17 +113,15 @@
$warning_schedule = $smartd::params::warning_schedule,
) inherits smartd::params {
validate_re($ensure, '^present$|^latest$|^absent$|^purged$')
validate_string($package_name)
validate_string($config_file)
validate_re($service_ensure, '^running$|^stopped$')

# Validate our booleans
validate_bool($devicescan)

# Validate our hashs
validate_string($devicescan_options)
validate_array($devices)
validate_hash($device_opts)

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

case $ensure {
Expand Down
2 changes: 1 addition & 1 deletion manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
$service_name = 'smartd'
$service_ensure = 'running'
$devicescan = true
$devicescan_options = false
$devicescan_options = undef
$devices = []
$device_opts = {}
$mail_to = 'root'
Expand Down

0 comments on commit 4c0ef6e

Please sign in to comment.