mirror of
https://github.com/ail-project/ail-framework.git
synced 2024-11-10 08:38:28 +00:00
fix: [IPAddress] catch empty config error
This commit is contained in:
parent
4d8db3fcc4
commit
8770bf05d7
1 changed files with 8 additions and 4 deletions
|
@ -16,6 +16,7 @@ and should be defined in the config.cfg file, under the [IP] section
|
||||||
|
|
||||||
import time
|
import time
|
||||||
import re
|
import re
|
||||||
|
import sys
|
||||||
from pubsublogger import publisher
|
from pubsublogger import publisher
|
||||||
from packages import Paste
|
from packages import Paste
|
||||||
from Helper import Process
|
from Helper import Process
|
||||||
|
@ -60,8 +61,12 @@ if __name__ == '__main__':
|
||||||
p = Process(config_section)
|
p = Process(config_section)
|
||||||
|
|
||||||
ip_networks = []
|
ip_networks = []
|
||||||
|
try:
|
||||||
for network in p.config.get("IP", "networks").split(","):
|
for network in p.config.get("IP", "networks").split(","):
|
||||||
ip_networks.append(IPv4Network(network))
|
ip_networks.append(IPv4Network(network))
|
||||||
|
except:
|
||||||
|
print('Please provide a list of valid IP addresses')
|
||||||
|
sys.exit(0)
|
||||||
|
|
||||||
|
|
||||||
# Sent to the logging a description of the module
|
# Sent to the logging a description of the module
|
||||||
|
@ -78,4 +83,3 @@ if __name__ == '__main__':
|
||||||
|
|
||||||
# Do something with the message from the queue
|
# Do something with the message from the queue
|
||||||
search_ip(message)
|
search_ip(message)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue