mirror of
https://github.com/OISF/suricata.git
synced 2026-05-28 04:32:12 -04:00
suricatactl: Make code compatible with Python 3
Call to suricatactl was failing with Python3 with the following error:
```
Traceback (most recent call last):
File "bin/suricatactl", line 40, in <module>
sys.exit(main())
File "./suricata/ctl/main.py", line 50, in main
args.func(args)
AttributeError: 'Namespace' object has no attribute 'func'
```
Fix this by making it run with Py3 just like it does with Py2.
Closes redmine ticket #2793
This commit is contained in:
parent
c47164ebc8
commit
ccea7fe50a
3 changed files with 6 additions and 4 deletions
|
|
@ -30,7 +30,6 @@ class InvalidAgeFormatError(Exception):
|
|||
pass
|
||||
|
||||
def register_args(parser):
|
||||
|
||||
parsers = parser.add_subparsers()
|
||||
|
||||
prune_parser = parsers.add_parser("prune")
|
||||
|
|
|
|||
|
|
@ -46,5 +46,8 @@ def main():
|
|||
filestore.register_args(subparsers.add_parser("filestore"))
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
args.func(args)
|
||||
try:
|
||||
func = args.func
|
||||
except AttributeError:
|
||||
parser.error("too few arguments")
|
||||
func(args)
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ from __future__ import print_function
|
|||
|
||||
import unittest
|
||||
|
||||
import filestore
|
||||
from suricata.ctl import filestore
|
||||
|
||||
class PruneTestCase(unittest.TestCase):
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue