-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Prevent error on GroupAnswers on VR creation #3018
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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: | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. By your changes, I am assuming that it is ok if we do not receive a routing table to be configured.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We could detect it each time we deploy a VR on 4.11.2 RC4 |
||
| empty_param = "table" if not table else "address" | ||
| logging.info("Empty parameter received %s while trying to add network route, skipping" % empty_param) | ||
| else: | ||
| 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) | ||
|
|
||
| def set_route(self, cmd, method="add"): | ||
| """ Add a route if it is not already defined """ | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isn't there a '!= None` missing in this expression? (x != None and x != "None") just paranoia, i guess
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we check here on "None" as a String? And not None as you should in Python?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think because somewhere the python None is stringyfied and gets in the way, @wido