Skip to content

Commit

Permalink
simplify udev::rule implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
Joshua Hoblitt committed Sep 20, 2013
1 parent a69f1b8 commit 3a469e7
Showing 1 changed file with 3 additions and 11 deletions.
14 changes: 3 additions & 11 deletions manifests/rule.pp
Original file line number Diff line number Diff line change
Expand Up @@ -54,16 +54,12 @@
if $content {
fail("${title}: parameters \$source and \$content are mutually exclusive")
}

$safe_source = { source => $source }
} elsif $content {
validate_string($content)

if $source {
fail("${title}: parameters \$source and \$content are mutually exclusive")
}

$safe_content = { content => $content }
} else {
# one of $source or $content is required unless we're removing the file,
if $ensure != 'absent' {
Expand All @@ -76,15 +72,11 @@
owner => 'root',
group => 'root',
mode => '0644',
content => $content,
source => $source,
notify => Class['udev::udevadm::trigger'],
}

$safe_config = merge(
$config,
$safe_source,
$safe_content
)

create_resources( 'file', { "/etc/udev/rules.d/${title}" => $safe_config } )
create_resources( 'file', { "/etc/udev/rules.d/${title}" => $config } )

}

0 comments on commit 3a469e7

Please sign in to comment.