netflow, migrate flowd aggregator to python 3

This commit is contained in:
Ad Schellevis 2019-05-17 16:41:08 +02:00
parent 0b40897fd3
commit 31982e2872
2 changed files with 5 additions and 4 deletions

View File

@ -1,4 +1,4 @@
#!/usr/local/bin/python2.7
#!/usr/local/bin/python3
"""
Copyright (c) 2016-2018 Ad Schellevis <ad@opnsense.org>
All rights reserved.
@ -160,7 +160,8 @@ class Main(object):
syslog.syslog(syslog.LOG_NOTICE, 'vacuum done')
except:
syslog.syslog(syslog.LOG_ERR, 'flowd aggregate died with message %s' % (traceback.format_exc()))
return
raise
# rotate if needed
check_rotate(self.config.flowd_source)
@ -213,7 +214,7 @@ if __name__ == '__main__':
sortby = 'cumulative'
ps = pstats.Stats(pr, stream=s).sort_stats(sortby)
ps.print_stats()
print s.getvalue()
print (s.getvalue())
else:
Main()
elif cmd_args.repair:

View File

@ -44,7 +44,7 @@ class Interfaces(object):
subprocess.call(['/sbin/ifconfig', '-l'], stdout=output_stream, stderr=open(os.devnull, 'wb'))
output_stream.seek(0)
if_index = 1
for line in output_stream.read().split('\n')[0].split():
for line in output_stream.readline().split():
self._if_index["%s" % if_index] = line
if_index += 1