Skip to content

Commit

Permalink
Make specifying zookeeper in topo files optional
Browse files Browse the repository at this point in the history
For pure golang topologies we don't require zookeeper anymore,
so we should also not require zookeeper to be specified in the topo file.
  • Loading branch information
lukedirtwalker committed Oct 25, 2019
1 parent a9de604 commit 37a390f
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 7 deletions.
3 changes: 0 additions & 3 deletions python/topology/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,6 @@ def _read_defaults(self, network):
priv_net = DEFAULT_PRIV_NETWORK
self.subnet_gen = SubnetGenerator(def_network, self.args.docker, self.args.in_docker)
self.prvnet_gen = SubnetGenerator(priv_net, self.args.docker, self.args.in_docker)
if "zookeepers" not in defaults:
logging.critical("No zookeeper configured in the topology!")
sys.exit(1)
self.default_mtu = defaults.get("mtu", DEFAULT_MTU)

def generate_all(self):
Expand Down
5 changes: 5 additions & 0 deletions python/topology/topo.py
Original file line number Diff line number Diff line change
Expand Up @@ -329,10 +329,15 @@ def _gen_sig_entries(self, topo_id):
self.topo_dicts[topo_id]['SIG'][elem_id] = d

def _gen_zk_entries(self, topo_id, as_conf):
if ("defaults" not in self.args.topo_config_dict or
"zookeepers" not in self.args.topo_config_dict["defaults"]):
return
zk_conf = self.args.topo_config_dict["defaults"]["zookeepers"]
if len(zk_conf) > 1:
logging.critical("Only one zk instance is supported!")
sys.exit(1)
if len(zk_conf) < 1:
return
addr = zk_conf[1].get("addr", None)
port = zk_conf[1].get("port", None)
zk_entry = self._gen_zk_entry(addr, port, self.args.in_docker, self.args.docker)
Expand Down
4 changes: 0 additions & 4 deletions topology/Tiny.topo
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
--- # Tiny Topology
defaults:
zookeepers:
1:
addr: 127.0.0.1
ASes:
"1-ff00:0:110": # old 1-11
core: true
Expand Down

0 comments on commit 37a390f

Please sign in to comment.