From e48e67705f9368bcf7229600f5ce08d87fb01cad Mon Sep 17 00:00:00 2001 From: Hidden Z Date: Tue, 2 Nov 2010 16:28:45 +0000 Subject: [PATCH] py-i2phosts-builder: require "hostsfile" to be defined "hostsfile" should be defined by passing command-line option "-f" or using config option --- py-i2phosts-builder | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/py-i2phosts-builder b/py-i2phosts-builder index ff1edf4..b7f7f44 100755 --- a/py-i2phosts-builder +++ b/py-i2phosts-builder @@ -42,10 +42,13 @@ from web.lib.utils import validate_config validate_config(config) # result hosts.txt -if 'hostsfile' in config: - hostsfile = config['hostsfile'] if args.file: hostsfile = args.file +elif config['hostsfile'] != None: + hostsfile = config['hostsfile'] +else: + sys.stderr.write('Please specify "-f" or define "hostsfile" in config\n') + sys.exit(1) f = open(hostsfile, 'w') # get activated hosts