Add port and protocol validation
This commit is contained in:
parent
4f70cf69b3
commit
c3aa3715c6
16
threshold
16
threshold
|
@ -187,6 +187,12 @@ class Helper(object):
|
|||
incUsage("connect")
|
||||
return
|
||||
|
||||
try:
|
||||
int(spl[3])
|
||||
except:
|
||||
failure("Port must be an integer, not %s" % spl[3])
|
||||
return
|
||||
|
||||
pool[spl[1]] = { "address": spl[2],
|
||||
"port": spl[3],
|
||||
"protocol": protocol,
|
||||
|
@ -252,6 +258,16 @@ class Helper(object):
|
|||
if not spl[2] in pool[spl[1]].keys():
|
||||
failure("No such key: %s" % spl[2])
|
||||
return
|
||||
if spl[2] == "port":
|
||||
try:
|
||||
int(spl[3])
|
||||
except:
|
||||
failure("Port must be an integer, not %s" % spl[3])
|
||||
return
|
||||
if spl[2] == "protocol":
|
||||
if not spl[3] in ["ssl", "plain"]:
|
||||
failure("Protocol must be ssl or plain, not %s" % spl[3])
|
||||
return
|
||||
if spl[3] == pool[spl[1]][spl[2]]:
|
||||
failure("Value already exists: %s" % spl[3])
|
||||
return
|
||||
|
|
Loading…
Reference in New Issue