summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMagnus Ahltorp <map@kth.se>2017-06-30 10:48:21 +0200
committerLinus Nordberg <linus@nordu.net>2017-07-06 17:48:30 +0200
commit4e44c1e8a4ea6ec4c5eeb2a1a05d93e076c7fd50 (patch)
treed4a6945f3399324e4db99673449c425ebd9e3c78
parentbb71cbabaac8baf18f7a685339f0e2670b019d91 (diff)
Replace 'localnodes' config with 'nodename'
Also some cleanup
-rw-r--r--test/catlfish-test-local-frontend-1.cfg16
-rw-r--r--test/catlfish-test-local-frontend-2.cfg3
-rw-r--r--test/catlfish-test-local-frontend-3.cfg3
-rw-r--r--test/catlfish-test-local-merge-1.cfg3
-rw-r--r--test/catlfish-test-local-merge-2.cfg8
-rw-r--r--test/catlfish-test-local-merge-3.cfg8
-rw-r--r--test/catlfish-test-local-signing-1.cfg6
-rw-r--r--test/catlfish-test-local-statusserver.cfg6
-rwxr-xr-xtools/compileconfig.py27
-rw-r--r--tools/readconfig.py18
10 files changed, 39 insertions, 59 deletions
diff --git a/test/catlfish-test-local-frontend-1.cfg b/test/catlfish-test-local-frontend-1.cfg
index 4867672..8ab141c 100644
--- a/test/catlfish-test-local-frontend-1.cfg
+++ b/test/catlfish-test-local-frontend-1.cfg
@@ -1,18 +1,12 @@
-localnodes:
- - frontend-1
+nodename: frontend-1
-frontendaddresses:
- frontend-1: 127.0.0.1:8082
+frontendaddress: 127.0.0.1:8082
-ctapiaddresses:
- frontend-1: 127.0.0.1:8080
+ctapiaddress: 127.0.0.1:8080
-storageaddresses:
- frontend-1: 127.0.0.1:8081
+storageaddress: 127.0.0.1:8081
-
-#publichttpaddresses:
-# frontend-1: 127.0.0.1:8090
+#publichttpaddress: 127.0.0.1:8090
paths:
configdir: .
diff --git a/test/catlfish-test-local-frontend-2.cfg b/test/catlfish-test-local-frontend-2.cfg
index 2a6462a..3a2e649 100644
--- a/test/catlfish-test-local-frontend-2.cfg
+++ b/test/catlfish-test-local-frontend-2.cfg
@@ -1,5 +1,4 @@
-localnodes:
- - frontend-2
+nodename: frontend-2
paths:
configdir: .
diff --git a/test/catlfish-test-local-frontend-3.cfg b/test/catlfish-test-local-frontend-3.cfg
index 430cef6..27dab58 100644
--- a/test/catlfish-test-local-frontend-3.cfg
+++ b/test/catlfish-test-local-frontend-3.cfg
@@ -1,5 +1,4 @@
-localnodes:
- - frontend-3
+nodename: frontend-3
paths:
configdir: .
diff --git a/test/catlfish-test-local-merge-1.cfg b/test/catlfish-test-local-merge-1.cfg
index 389a440..2de391e 100644
--- a/test/catlfish-test-local-merge-1.cfg
+++ b/test/catlfish-test-local-merge-1.cfg
@@ -1,8 +1,5 @@
nodename: merge-1
-localnodes:
- - merge-1
-
paths:
configdir: .
mergedb: machine/merge-1/db
diff --git a/test/catlfish-test-local-merge-2.cfg b/test/catlfish-test-local-merge-2.cfg
index d42cbf3..9a83566 100644
--- a/test/catlfish-test-local-merge-2.cfg
+++ b/test/catlfish-test-local-merge-2.cfg
@@ -1,11 +1,7 @@
-localnodes:
- - merge-2
-
-addresses:
- merge-2: 127.0.0.1:8182
-
nodename: merge-2
+mergeaddress: 127.0.0.1:8182
+
#dbbackend: permdb
paths:
diff --git a/test/catlfish-test-local-merge-3.cfg b/test/catlfish-test-local-merge-3.cfg
index f6da89e..8c4b4c6 100644
--- a/test/catlfish-test-local-merge-3.cfg
+++ b/test/catlfish-test-local-merge-3.cfg
@@ -1,11 +1,7 @@
-localnodes:
- - merge-3
-
-addresses:
- merge-3: 127.0.0.1:8183
-
nodename: merge-3
+mergeaddress: 127.0.0.1:8183
+
paths:
configdir: .
knownroots: known_roots
diff --git a/test/catlfish-test-local-signing-1.cfg b/test/catlfish-test-local-signing-1.cfg
index 0eccc94..a2eaff5 100644
--- a/test/catlfish-test-local-signing-1.cfg
+++ b/test/catlfish-test-local-signing-1.cfg
@@ -1,8 +1,6 @@
-localnodes:
- - signing-1
+nodename: signing-1
-addresses:
- signing-1: 127.0.0.1:8088
+signingaddress: 127.0.0.1:8088
paths:
configdir: .
diff --git a/test/catlfish-test-local-statusserver.cfg b/test/catlfish-test-local-statusserver.cfg
index 190c611..cef11e6 100644
--- a/test/catlfish-test-local-statusserver.cfg
+++ b/test/catlfish-test-local-statusserver.cfg
@@ -1,8 +1,6 @@
-localnodes:
- - statusserver
+nodename: statusserver
-publichttpaddresses:
- statusserver: 127.0.0.1:9080
+publichttpaddress: 127.0.0.1:9080
paths:
configdir: .
diff --git a/tools/compileconfig.py b/tools/compileconfig.py
index e233cc7..94e0b51 100755
--- a/tools/compileconfig.py
+++ b/tools/compileconfig.py
@@ -240,13 +240,13 @@ def gen_config(nodename, config, localconfig):
paths = localconfig["paths"]
apikeys = api_keys(config)
bind_addresses = {
- "frontend": localconfig.get("frontendaddresses", {}).get(nodename),
- "storage": localconfig.get("storageaddresses", {}).get(nodename),
- "signing": localconfig.get("signingaddresses", {}).get(nodename),
- "merge": localconfig.get("mergeaddresses", {}).get(nodename),
+ "frontend": localconfig.get("frontendaddress"),
+ "storage": localconfig.get("storageaddress"),
+ "signing": localconfig.get("signingaddress"),
+ "merge": localconfig.get("mergeaddress"),
}
- bind_publicaddress = localconfig.get("ctapiaddresses", {}).get(nodename)
- bind_publichttpaddress = localconfig.get("publichttpaddresses", {}).get(nodename)
+ bind_publicaddress = localconfig.get("ctapiaddress")
+ bind_publichttpaddress = localconfig.get("publichttpaddress")
options = localconfig.get("options", [])
configfile = open(paths["configdir"] + "/" + nodename + ".config", "w")
@@ -270,7 +270,7 @@ def gen_config(nodename, config, localconfig):
reloadableplopconfig = []
if nodetype & set(["frontendnodes", "mergenodes"]):
- catlfishconfig.append((Symbol("known_roots_path"), localconfig["paths"]["knownroots"]))
+ catlfishconfig.append((Symbol("known_roots_path"), paths["knownroots"]))
if "frontendnodes" in nodetype:
plopconfig.append((Symbol("sptcache_root_path"), paths["db"] + "sctcache"))
if "ratelimits" in localconfig:
@@ -320,9 +320,6 @@ def gen_config(nodename, config, localconfig):
plopconfig += [
(Symbol("fsync_parallel_tasks"), 4),
]
- if dbbackend == "permdb" and len(localconfig["localnodes"]) != 1:
- print >>sys.stderr, "When using permdb, all services have to be in the same node"
- sys.exit(1)
#print "nodetype", ", ".join(nodetype)
if nodetype & set(["frontendnodes", "storagenodes"]):
@@ -566,13 +563,17 @@ def printnodenames(config):
def main():
parser = argparse.ArgumentParser(description="")
- parser.add_argument('--config', help="System configuration", required=True)
+ parser.add_argument('--config', help="System configuration")
parser.add_argument('--localconfig', help="Local configuration")
parser.add_argument("--testmakefile", metavar="file", help="Generate makefile variables for test")
parser.add_argument("--testshellvars", metavar="file", help="Generate shell variable file for test")
parser.add_argument("--getnodenames", action='store_true', help="Get list of node names")
args = parser.parse_args()
+ if not args.config:
+ print >>sys.stderr, "--config is required"
+ sys.exit(1)
+
if args.testmakefile:
config = readconfig.read_config(args.config)
gen_testmakefile(config, args.testmakefile)
@@ -586,9 +587,7 @@ def main():
localconfig = readconfig.read_config(args.localconfig)
config = readconfig.verify_and_read_config(args.config, localconfig["logadminkey"])
- localnodes = localconfig["localnodes"]
- for localnode in localnodes:
- gen_config(localnode, config, localconfig)
+ gen_config(localconfig["nodename"], config, localconfig)
else:
print >>sys.stderr, "Nothing to do"
sys.exit(1)
diff --git a/tools/readconfig.py b/tools/readconfig.py
index 69531ca..028e319 100644
--- a/tools/readconfig.py
+++ b/tools/readconfig.py
@@ -5,16 +5,19 @@ import yaml
import base64
import sys
+def render_path(path):
+ if path:
+ return "'" + ", ".join(path) + "'"
+ else:
+ return "the top level"
+
class ErrorHandlingDict(dict):
def __init__(self, filename, path):
self._filename = filename
self._path = path
dict.__init__({})
def __missing__(self, key):
- if self._path:
- path = ", ".join(self._path)
- else:
- path = "the top level"
+ path = render_path(self._path)
print >>sys.stderr, "error: could not find configuration key '%s' at %s in %s" % (key, path, self._filename)
sys.exit(1)
@@ -52,8 +55,9 @@ def verify_and_read_config(filename, publickey_base64):
signature = open(filename + ".sig").read()
verify_config(rawconfig, signature, publickey_base64, filename)
-
- return errorhandlify(yaml.load(io.BytesIO(rawconfig), yaml.SafeLoader), filename)
+ config = yaml.load(io.BytesIO(rawconfig), yaml.SafeLoader)
+ return errorhandlify(config, filename)
def read_config(filename):
- return errorhandlify(yaml.load(open(filename), yaml.SafeLoader), filename)
+ config = yaml.load(open(filename), yaml.SafeLoader)
+ return errorhandlify(config, filename)