diff --git a/warden3/contrib/connectors/hp-kippo/README b/warden3/contrib/connectors/hp-kippo/README index 8096b5a3d1cfd7ef2880fa1cdb7ab9bcfb88c5d6..57ed8604c7d0b6e92a91a657264c525ca7832a09 100644 --- a/warden3/contrib/connectors/hp-kippo/README +++ b/warden3/contrib/connectors/hp-kippo/README @@ -56,7 +56,7 @@ D. Configuration cron SCRIPT_PATH=/opt/warden_client/ - */5 * * * * root cd $SCRIPT_PATH; warden3-kippo-sender.py > /dev/null 2>&1 + */5 * * * * root cd $SCRIPT_PATH; python warden3-kippo-sender.py > /dev/null 2>&1 Note: Repeat interval must be the same as value of 'awin'. diff --git a/warden3/contrib/connectors/hp-kippo/warden3-kippo-sender.py b/warden3/contrib/connectors/hp-kippo/warden3-kippo-sender.py index 014d2561cb192d402f5280e06f851fe2ad70a81d..69eb7f4bcf6b6d22605e5377908d3f2f6bf9c477 100644 --- a/warden3/contrib/connectors/hp-kippo/warden3-kippo-sender.py +++ b/warden3/contrib/connectors/hp-kippo/warden3-kippo-sender.py @@ -11,6 +11,7 @@ from time import time, gmtime, strftime from math import trunc from uuid import uuid4 from os import path +import sys import MySQLdb as my import MySQLdb.cursors as mycursors @@ -71,14 +72,16 @@ def main(): awin = aconfig.get('awin', DEFAULT_AWIN) * 60 wconfig['name'] = aname + wclient = Client(**wconfig) aanonymised = aconfig.get('anonymised', DEFAULT_ANONYMISED) - atargetnet = aconfig.get('target_net', DEFAULT_TARGET_NET) + if aanonymised not in ['no', 'yes', 'omit']: + wclient.logger.error("Configuration error: anonymised: '%s' - possible typo? use 'no', 'yes' or 'omit'" % aanonymised) + sys.exit(2) + atargetnet = aconfig.get('target_net', DEFAULT_TARGET_NET) aanonymised = aanonymised if (atargetnet != DEFAULT_TARGET_NET) or (aanonymised == 'omit') else DEFAULT_ANONYMISED - wclient = Client(**wconfig) - con = my.connect( host=aconfig['dbhost'], user=aconfig['dbuser'], passwd=aconfig['dbpass'], db=aconfig['dbname'], port=aconfig['dbport'], cursorclass=mycursors.DictCursor)