Skip to content
Snippets Groups Projects
Commit 0bb458f8 authored by Michal Kostěnec's avatar Michal Kostěnec Committed by root
Browse files

Test for correct options for anonymisation

Minor updates
parent a8dc34c5
No related branches found
No related tags found
No related merge requests found
...@@ -56,7 +56,7 @@ D. Configuration ...@@ -56,7 +56,7 @@ D. Configuration
cron cron
SCRIPT_PATH=/opt/warden_client/ 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'. Note: Repeat interval must be the same as value of 'awin'.
......
...@@ -11,6 +11,7 @@ from time import time, gmtime, strftime ...@@ -11,6 +11,7 @@ from time import time, gmtime, strftime
from math import trunc from math import trunc
from uuid import uuid4 from uuid import uuid4
from os import path from os import path
import sys
import MySQLdb as my import MySQLdb as my
import MySQLdb.cursors as mycursors import MySQLdb.cursors as mycursors
...@@ -71,14 +72,16 @@ def main(): ...@@ -71,14 +72,16 @@ def main():
awin = aconfig.get('awin', DEFAULT_AWIN) * 60 awin = aconfig.get('awin', DEFAULT_AWIN) * 60
wconfig['name'] = aname wconfig['name'] = aname
wclient = Client(**wconfig)
aanonymised = aconfig.get('anonymised', DEFAULT_ANONYMISED) 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 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'], con = my.connect( host=aconfig['dbhost'], user=aconfig['dbuser'], passwd=aconfig['dbpass'],
db=aconfig['dbname'], port=aconfig['dbport'], cursorclass=mycursors.DictCursor) db=aconfig['dbname'], port=aconfig['dbport'], cursorclass=mycursors.DictCursor)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment