diff --git a/opl/cluster_read.py b/opl/cluster_read.py index c76f16c..cfba6a0 100755 --- a/opl/cluster_read.py +++ b/opl/cluster_read.py @@ -386,8 +386,8 @@ def measure( """ Execute command "command" and return result as per its "output" configuration """ - name = config['name'] - log_source_command = config['log_source_command'] + name = config["name"] + log_source_command = config["log_source_command"] result = execute(log_source_command).splitlines() output = {} @@ -396,12 +396,12 @@ def measure( for pattern_name, pattern_value in config.items(): if not pattern_name.startswith("log_regexp_"): continue - pattern_key = pattern_name[len("log_regexp_"):] + pattern_key = pattern_name[len("log_regexp_") :] pattern_regexp = re.compile(pattern_value) counter = 0 for line in result: if pattern_regexp.search(line): - counter+=1 + counter += 1 output[pattern_key] = counter return name, output diff --git a/tests/test_cluster_read.py b/tests/test_cluster_read.py index 3770c56..06664c8 100755 --- a/tests/test_cluster_read.py +++ b/tests/test_cluster_read.py @@ -39,7 +39,7 @@ def test_count(self): k, v = next(ri) self.assertEqual(k, "print.output") self.assertEqual(v, {"all": 4, "error": 1, "warning": 1}) - + def test_count_large(self): string = """ - name: print.output