Commit de0a46cb authored by juga's avatar juga Committed by Matt Traudt
Browse files

Create generator_started line only when it is known

parent 6912a1fb
......@@ -76,14 +76,14 @@ def read_started_ts(conf):
try:
filepath = conf['paths']['started_filepath']
except TypeError:
return ''
return None
try:
with FileLock(filepath):
with open(filepath, 'r') as fd:
generator_started = fd.read()
except FileNotFoundError as e:
log.warn('File %s not found.%s', filepath, e)
return ''
return None
return generator_started
......@@ -229,7 +229,8 @@ class V3BWHeader(object):
timestamp = str(latest_bandwidth)
kwargs['latest_bandwidth'] = unixts_to_isodt_str(latest_bandwidth)
kwargs['earliest_bandwidth'] = unixts_to_isodt_str(earliest_bandwidth)
kwargs['generator_started'] = generator_started
if generator_started is not None:
kwargs['generator_started'] = generator_started
h = cls(timestamp, **kwargs)
return h
......
Supports Markdown
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