rafaelweingartner commented on a change in pull request #3018: Prevent error on
GroupAnswers on VR creation
URL: https://github.com/apache/cloudstack/pull/3018#discussion_r232352155
##########
File path: systemvm/debian/opt/cloud/bin/cs/CsRoute.py
##########
@@ -50,20 +50,29 @@ def add_route(self, dev, address):
""" Wrapper method that adds table name and device to route statement
"""
# ip route add dev eth1 table Table_eth1 10.0.2.0/24
table = self.get_tablename(dev)
- logging.info("Adding route: dev " + dev + " table: " +
- table + " network: " + address + " if not present")
- cmd = "dev %s table %s %s" % (dev, table, address)
- cmd = "default via %s table %s proto static" % (address, table)
- self.set_route(cmd)
+
+ if not table or not address:
+ empty_param = "table" if not table else "address"
+ logging.info("Empty parameter received %s while trying to add
route, skipping" % empty_param)
+ else:
+ logging.info("Adding route: dev " + dev + " table: " +
+ table + " network: " + address + " if not present")
+ cmd = "default via %s table %s proto static" % (address, table)
+ self.set_route(cmd)
def add_network_route(self, dev, address):
""" Wrapper method that adds table name and device to route statement
"""
# ip route add dev eth1 table Table_eth1 10.0.2.0/24
table = self.get_tablename(dev)
- logging.info("Adding route: dev " + dev + " table: " +
- table + " network: " + address + " if not present")
- cmd = "throw %s table %s proto static" % (address, table)
- self.set_route(cmd)
+
+ if not table or not address:
Review comment:
By your changes, I am assuming that it is ok if we do not receive a routing
table to be configured.
Do you know in which cases this situation might happen?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services