-
Notifications
You must be signed in to change notification settings - Fork 43
Fix multiple prefix support in libcalico #151
Conversation
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.
This basically LGTM - I've just suggested a couple of slight simplifications to the code. WDYT?
@@ -298,6 +298,18 @@ def ensure_global_config(self): | |||
# We are always ready. | |||
self.etcd_client.write(CALICO_V_PATH + "/Ready", "true") | |||
|
|||
def _ensure_interface_prefix(self): | |||
try: | |||
if_prefix = self.etcd_client.read(CONFIG_IF_PREF_PATH).value |
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.
Move prefixes = ...
line here.
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.
Done
if_prefix = self.etcd_client.read(CONFIG_IF_PREF_PATH).value | ||
except EtcdKeyNotFound: | ||
self.etcd_client.write(CONFIG_IF_PREF_PATH, IF_PREFIX) | ||
return |
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.
Delete previous two lines, and instead put prefixes = []
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.
Done.
ensure_global_config now appends interface prefix for calico if it is not present.
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.
Thanks!
Function
ensure_global_config
now appends interface prefix for calicoif it is not present.