apache_log_metrics.py: Fix "ip_addr" group match
A bug was introduced by switching to named regex match groups - the
ip_addr group was referenced as "ipaddr".
BUG=chromium:630776
TEST=added a unit test.
Change-Id: I6a51c2c18aeffc2fbda53446c5e5690ae53060cc
Reviewed-on: https://chromium-review.googlesource.com/362588
Reviewed-by: Richard Barnette <jrbarnette@google.com>
Tested-by: Paul Hobbs <phobbs@google.com>
diff --git a/apache_log_metrics.py b/apache_log_metrics.py
index 0d35d09..e94edd6 100755
--- a/apache_log_metrics.py
+++ b/apache_log_metrics.py
@@ -52,7 +52,7 @@
Args:
ip: An IPv4-formatted string.
"""
- return reduce(lambda (seed, x): seed * 2**8 + int(x),
+ return reduce(lambda seed, x: seed * 2**8 + int(x),
ip.split('.'),
0)
@@ -124,7 +124,7 @@
size, fields={
'build_config': build_config,
'milestone': milestone,
- 'in_lab': InLab(m.group('ipaddr')),
+ 'in_lab': InLab(m.group('ip_addr')),
'endpoint': filename})