Commit 407d20fe authored by Vincent Pelletier's avatar Vincent Pelletier

Replace print + sys.exit with parser.error .

parent a11c5e4f
...@@ -1180,14 +1180,12 @@ def main(): ...@@ -1180,14 +1180,12 @@ def main():
elif DURATION_S_FORMAT in args.logformat: elif DURATION_S_FORMAT in args.logformat:
getDuration = lambda x: int(x.group('duration_s')) * US_PER_S getDuration = lambda x: int(x.group('duration_s')) * US_PER_S
else: else:
print >> sys.stderr, 'Neither %D nor %T are present in logformat, apdex ' \ parser.error('Neither %D nor %T are present in logformat, apdex '
'cannot be computed.' 'cannot be computed.')
sys.exit(1)
if args.match_servername is not None and \ if args.match_servername is not None and \
args.match_servername not in args.logformat: args.match_servername not in args.logformat:
print >> sys.stderr, '--match-servername %s requested, but missing ' \ parser.error('--match-servername %s requested, but missing '
'from logformat.' % args.match_servername 'from logformat.' % args.match_servername)
sys.exit(1)
get_url_prefix = server_name_group_dict.get(args.match_servername, get_url_prefix = server_name_group_dict.get(args.match_servername,
lambda _: '') lambda _: '')
line_regex = '' line_regex = ''
...@@ -1239,9 +1237,8 @@ def main(): ...@@ -1239,9 +1237,8 @@ def main():
if default_site is None: if default_site is None:
default_action = None default_action = None
if not [None for _, _, x in site_list if x is not None]: if not [None for _, _, x in site_list if x is not None]:
print >> sys.stderr, 'None of --default, --erp5-base and --base were ' \ parser.error('None of --default, --erp5-base and --base were '
'specified, nothing to do.' 'specified, nothing to do.')
sys.exit(1)
else: else:
default_action = partial(GenericSiteStats, suffix=lambda x: x) default_action = partial(GenericSiteStats, suffix=lambda x: x)
site_caption_dict[None] = default_site site_caption_dict[None] = default_site
...@@ -1252,8 +1249,7 @@ def main(): ...@@ -1252,8 +1249,7 @@ def main():
file_count = len(infile_list) file_count = len(infile_list)
per_site = {} per_site = {}
if '-' in args.state_file and '-' in infile_list: if '-' in args.state_file and '-' in infile_list:
print >> sys.stderr, 'stdin cannot be used both as log and state input.' parser.error('stdin cannot be used both as log and state input.')
sys.exit(1)
loading_start_time = time.time() loading_start_time = time.time()
for state_file_name in args.state_file: for state_file_name in args.state_file:
print >> sys.stderr, 'Loading', state_file_name, '...', print >> sys.stderr, 'Loading', state_file_name, '...',
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment