From 50667bc5c4896557415ab28269d2aea3ac534bf4 Mon Sep 17 00:00:00 2001 From: Magnus Ahltorp Date: Fri, 27 Jan 2017 01:57:27 +0100 Subject: Separate erlang config file for reloadable parameters --- tools/compileconfig.py | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) (limited to 'tools/compileconfig.py') diff --git a/tools/compileconfig.py b/tools/compileconfig.py index 3961db3..0ee3fab 100755 --- a/tools/compileconfig.py +++ b/tools/compileconfig.py @@ -220,11 +220,19 @@ def gen_config(nodename, config, localconfig): configfile = open(paths["configdir"] + "/" + nodename + ".config", "w") print >>configfile, "%% catlfish configuration file (-*- erlang -*-)" + plopcontrolfilename = nodename + ".plopcontrol" + + plopconfigfilename = paths["configdir"] + "/" + nodename + ".plopconfig" + plopconfigfile = open(plopconfigfilename, "w") + + print >>plopconfigfile, "%% plop configuration file (-*- erlang -*-)" + (nodetype, nodeconfig) = get_node_config(nodename, config) (http_servers, https_servers) = gen_http_servers(nodetype, nodeconfig, bind_addresses, bind_publicaddress, bind_publichttpaddress=bind_publichttpaddress) catlfishconfig = [] plopconfig = [] + reloadableplopconfig = [] if nodetype & set(["frontendnodes", "mergenodes"]): catlfishconfig.append((Symbol("known_roots_path"), localconfig["paths"]["knownroots"])) @@ -312,8 +320,8 @@ def gen_config(nodename, config, localconfig): if "frontendnodes" in nodetype: storagenodenames = [node["name"] for node in config["storagenodes"]] - plopconfig.append((Symbol("storage_nodes"), storagenodeaddresses)) - plopconfig.append((Symbol("storage_nodes_quorum"), config["storage-quorum-size"])) + reloadableplopconfig.append((Symbol("storage_nodes"), storagenodeaddresses)) + reloadableplopconfig.append((Symbol("storage_nodes_quorum"), config["storage-quorum-size"])) services.add(Symbol("ht")) allowed_clients += allowed_clients_frontend(mergenodenames, primarymergenode) allowed_clients += allowed_clients_public() @@ -325,13 +333,12 @@ def gen_config(nodename, config, localconfig): services = [Symbol("sign")] if "mergenodes" in nodetype: storagenodenames = [node["name"] for node in config["storagenodes"]] - plopconfig.append((Symbol("storage_nodes"), storagenodeaddresses)) - plopconfig.append((Symbol("storage_nodes_quorum"), config["storage-quorum-size"])) + reloadableplopconfig.append((Symbol("storage_nodes"), storagenodeaddresses)) + reloadableplopconfig.append((Symbol("storage_nodes_quorum"), config["storage-quorum-size"])) services.add(Symbol("ht")) allowed_clients += allowed_clients_mergesecondary(primarymergenode) plopconfig += [ - (Symbol("publickey_path"), paths["publickeys"]), (Symbol("services"), list(services)), ] if "signingnodes" in nodetype: @@ -348,8 +355,13 @@ def gen_config(nodename, config, localconfig): (Symbol("own_key"), (nodename, "%s/%s-private.pem" % (paths["privatekeys"], nodename))), ] if "frontendnodes" in nodetype: - plopconfig.append((Symbol("signing_nodes"), signingnodeaddresses)) + reloadableplopconfig.append((Symbol("signing_nodes"), signingnodeaddresses)) plopconfig += [ + (Symbol("plopconfig"), plopconfigfilename), + (Symbol("plopcontrol"), plopcontrolfilename), + ] + + reloadableplopconfig += [ (Symbol("allowed_clients"), list(allowed_clients)), (Symbol("allowed_servers"), list(allowed_servers)), (Symbol("apikeys"), apikeys), @@ -363,8 +375,10 @@ def gen_config(nodename, config, localconfig): ] print >>configfile, gen_erlang(erlangconfig) + ".\n" - + print >>plopconfigfile, gen_erlang(reloadableplopconfig) + ".\n" + configfile.close() + plopconfigfile.close() def gen_testmakefile(config, testmakefile, machines, shellvars=False): -- cgit v1.1