From 5c3ced682c222d6dca1882b1c07eefc08f2d249b Mon Sep 17 00:00:00 2001 From: Stephen Gran Date: Thu, 5 Apr 2012 15:00:19 +0100 Subject: [PATCH] guard against accidentally doing something Signed-off-by: Stephen Gran --- modules/site/manifests/linux_module.pp | 28 ++++++++++++++------------ 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/modules/site/manifests/linux_module.pp b/modules/site/manifests/linux_module.pp index 62b2197a4..8a81c6c0e 100644 --- a/modules/site/manifests/linux_module.pp +++ b/modules/site/manifests/linux_module.pp @@ -1,19 +1,21 @@ define site::linux_module ($ensure = present) { - case $ensure { - present: { - exec { "append_module_${name}": - command => "echo '${name}' >> /etc/modules", - unless => "grep -q -F -x '${name}' /etc/modules", + if $::kernel == linux { + case $ensure { + present: { + exec { "append_module_${name}": + command => "echo '${name}' >> /etc/modules", + unless => "grep -q -F -x '${name}' /etc/modules", + } } - } - absent: { - exec { "remove_module_${name}": - command => "sed -i -e'/^${name}\$/d' /etc/modules", - onlyif => "grep -q -F -x '${name}' /etc/modules", + absent: { + exec { "remove_module_${name}": + command => "sed -i -e'/^${name}\$/d' /etc/modules", + onlyif => "grep -q -F -x '${name}' /etc/modules", + } + } + default: { + err("invalid ensure value ${ensure}") } - } - default: { - err("invalid ensure value ${ensure}") } } } -- 2.20.1