Browse Source

injector: output errors to stderr

pull/1/head
Hidden Z 14 years ago
parent
commit
803bbef6c6
  1. 4
      injector

4
injector

@ -28,7 +28,7 @@ for line in f:
if line.startswith('#') or line.isspace(): if line.startswith('#') or line.isspace():
continue continue
if line.find('=') == -1: if line.find('=') == -1:
print 'Invalid line: %s' % line sys.stderr.write('Invalid line: %s\n' % line)
continue continue
# strip trailing '\n' # strip trailing '\n'
line = line.rstrip('\n') line = line.rstrip('\n')
@ -37,7 +37,7 @@ for line in f:
hostname = validate_hostname(entry[0]) hostname = validate_hostname(entry[0])
base64 = validate_b64hash(entry[1], check_uniq=False) # don't require uniqueness base64 = validate_b64hash(entry[1], check_uniq=False) # don't require uniqueness
except ValidationError, e: except ValidationError, e:
print 'validation error: %s: %s' % (e, line) sys.stderr.write('validation error: %s: %s\n' % (e, line))
else: else:
# Check for already existed hosts in database to avoid unneeded INSERTs # Check for already existed hosts in database to avoid unneeded INSERTs
# beacuse they will fail anyway. # beacuse they will fail anyway.

Loading…
Cancel
Save