Commit 20513242 authored by Leo Iannacone's avatar Leo Iannacone

module: do not take care of success if not needed - prevent to always store false value

parent 771e7d18
...@@ -32,6 +32,7 @@ from collections import defaultdict ...@@ -32,6 +32,7 @@ from collections import defaultdict
class DebomaticModule_JSONLoggerStart: class DebomaticModule_JSONLoggerStart:
def __init__(self): def __init__(self):
self.logger = DebomaticModule_JSONLogger() self.logger = DebomaticModule_JSONLogger()
self.first = True self.first = True
...@@ -44,6 +45,7 @@ class DebomaticModule_JSONLoggerStart: ...@@ -44,6 +45,7 @@ class DebomaticModule_JSONLoggerStart:
class DebomaticModule_JSONLoggerStop: class DebomaticModule_JSONLoggerStop:
def __init__(self): def __init__(self):
self.logger = DebomaticModule_JSONLogger() self.logger = DebomaticModule_JSONLogger()
self.last = True self.last = True
...@@ -73,11 +75,12 @@ class DebomaticModule_JSONLogger: ...@@ -73,11 +75,12 @@ class DebomaticModule_JSONLogger:
return ('%(directory)s/pool/%(package)s/%(package)s.json' % return ('%(directory)s/pool/%(package)s/%(package)s.json' %
{'directory': args.directory, 'package': args.package}) {'directory': args.directory, 'package': args.package})
def _get_distribution_status(self, args): def _get_distribution_status(self, args, with_success=False):
"""From args to distribution status""" """From args to distribution status"""
status = {} status = {}
status['status'] = args.action status['status'] = args.action
status['distribution'] = args.distribution status['distribution'] = args.distribution
if with_success:
status['success'] = args.success status['success'] = args.success
return status return status
...@@ -129,7 +132,7 @@ class DebomaticModule_JSONLogger: ...@@ -129,7 +132,7 @@ class DebomaticModule_JSONLogger:
self._append_json_logfile(args, distribution) self._append_json_logfile(args, distribution)
def post_chroot(self, args): def post_chroot(self, args):
distribution = self._get_distribution_status(args) distribution = self._get_distribution_status(args, with_success=True)
self._append_json_logfile(args, distribution) self._append_json_logfile(args, distribution)
def pre_build(self, args): def pre_build(self, args):
...@@ -164,6 +167,7 @@ class DebomaticModule_JSONLogger: ...@@ -164,6 +167,7 @@ class DebomaticModule_JSONLogger:
# Parser for log files # Parser for log files
class LogParser(): class LogParser():
def __init__(self, file_path): def __init__(self, file_path):
self.file = file_path self.file = file_path
self.basename = os.path.basename(file_path) self.basename = os.path.basename(file_path)
......
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