Commit c960383f authored by Tomas Hlavacek's avatar Tomas Hlavacek

Fix bug in parameter verification procedure

Fix bug in parameter verification implementation which did the
verification and produced error but instead of returning the error
out of the command call routine it passed error message as the parameter
of the command and executed it.
parent 555e5c80
...@@ -195,7 +195,7 @@ class IPv4SubnetParameter(AddressParameter): ...@@ -195,7 +195,7 @@ class IPv4SubnetParameter(AddressParameter):
def _resolveAddress(self,input): def _resolveAddress(self,input):
addr = AddressParameter._resolveAddress(self,input) addr = AddressParameter._resolveAddress(self,input)
if(addr): if(addr):
return (addr + '/32') return (addr)
else: else:
return None return None
...@@ -212,7 +212,7 @@ class IPv6SubnetParameter(AddressParameter): ...@@ -212,7 +212,7 @@ class IPv6SubnetParameter(AddressParameter):
def _resolveAddress(self,input): def _resolveAddress(self,input):
addr = AddressParameter._resolveAddress(self,input) addr = AddressParameter._resolveAddress(self,input)
if(addr): if(addr):
return (addr + '/128') return (addr)
else: else:
return None return None
...@@ -391,16 +391,25 @@ class Router(object): ...@@ -391,16 +391,25 @@ class Router(object):
if(c == None): if(c == None):
log("Bad params encountered in command "+str(command.getName())+" : "+str(parameters)) log("Bad params encountered in command "+str(command.getName())+" : "+str(parameters))
return self.returnError(defaults.STRING_BAD_PARAMS) return None
debug("Going to run command "+c+" on router "+self.getName()) debug("Going to run command "+c+" on router "+self.getName())
return c return c
def runSyncCommand(self,command,parameters): def runSyncCommand(self,command,parameters):
return self.runRawSyncCommand(self.__prepareCommand(command,parameters)) c = self.__prepareCommand(command,parameters)
if(c):
return self.runRawSyncCommand(c)
else:
return self.returnError(defaults.STRING_BAD_PARAMS)
def runAsyncCommand(self,command,parameters,outfile): def runAsyncCommand(self,command,parameters,outfile):
return self.runRawCommand(self.__prepareCommand(command,parameters),outfile) c = self.__prepareCommand(command,parameters)
if(c):
return self.runRawCommand(c,outfile)
else:
outfile.write(self.returnError(defaults.STRING_BAD_PARAMS))
return
def runRawSyncCommand(self,command): def runRawSyncCommand(self,command):
cr = StringIO.StringIO() cr = StringIO.StringIO()
......
Markdown is supported
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