Refactored abusehelper init, added support for $abusesa_botnets

This commit is contained in:
Ossi Salmi 2013-03-07 14:21:18 +02:00
parent 7ba77ed2ea
commit 12791c5891
2 changed files with 60 additions and 35 deletions

View file

@ -2,6 +2,9 @@
#
# === Global variables
#
# $abusehelper_datadir
# Abusehelper home directory. Defaults to /var/lib/ah2.
#
# $abusehelper_botnets
# Array of botnet paths to start at boot.
#
@ -113,11 +116,25 @@ class abusehelper {
}
}
if $abusehelper_botnets {
include abusehelper::init
}
}
# Install abusehelper init script.
#
class abusehelper::init {
if !$abusehelper_botnets {
fail("Must define \$abusehelper_botnets")
}
if !$abusehelper_user {
$abusehelper_user = "abusehel"
}
if $abusehelper_botnets {
file { "/etc/sysconfig/botnet":
ensure => present,
name => $::operatingsystem ? {
@ -154,6 +171,5 @@ class abusehelper {
service { "botnet":
enable => true,
}
}
}

View file

@ -5,6 +5,9 @@
# $abusesa_datadir
# AbuseSA home directory. Defaults to /var/lib/abusesa.
#
# $abusesa_botnets
# Array of botnet paths to start at boot.
#
class abusesa {
case $::operatingsystem {
@ -76,4 +79,10 @@ class abusesa {
}
python::setup::install { "/usr/local/src/abusesa": }
if $abusesa_botnets {
$abusehelper_botnets = $abusesa_botnets
$abusehelper_user = "abusesa"
include abusehelper::init
}
}