From 06a6db0d0dc921527c4667037d7cc9fa000645d5 Mon Sep 17 00:00:00 2001 From: Magnus Ahltorp Date: Thu, 2 Feb 2017 16:08:24 +0100 Subject: Added tools for getting and generating global config --- tools/compileconfig.py | 13 ++++++++++ tools/genconfig.sh | 43 +++++++++++++++++++++++++++++++ tools/getconfig.py | 68 ++++++++++++++++++++++++++++++++++++++++++++++++++ tools/getconfig.sh | 29 +++++++++++++++++++++ tools/loginfo.py | 1 - tools/readconfig.py | 13 +++++++--- 6 files changed, 162 insertions(+), 5 deletions(-) create mode 100755 tools/genconfig.sh create mode 100755 tools/getconfig.py create mode 100755 tools/getconfig.sh (limited to 'tools') diff --git a/tools/compileconfig.py b/tools/compileconfig.py index b5e5053..28d01b0 100755 --- a/tools/compileconfig.py +++ b/tools/compileconfig.py @@ -365,6 +365,7 @@ def gen_config(nodename, config, localconfig): (Symbol("allowed_clients"), list(allowed_clients)), (Symbol("allowed_servers"), list(allowed_servers)), (Symbol("apikeys"), apikeys), + (Symbol("version"), config["version"]), ] erlangconfig = [ @@ -405,12 +406,21 @@ def gen_testmakefile(config, testmakefile, machines, shellvars=False): configfile.close() +def printnodenames(config): + frontendnodenames = set([node["name"] for node in config["frontendnodes"]]) + storagenodenames = set([node["name"] for node in config["storagenodes"]]) + signingnodenames = set([node["name"] for node in config["signingnodes"]]) + mergenodenames = set([node["name"] for node in config["mergenodes"]]) + + print " ".join(frontendnodenames|storagenodenames|signingnodenames|mergenodenames) + def main(): parser = argparse.ArgumentParser(description="") parser.add_argument('--config', help="System configuration", required=True) 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") parser.add_argument("--machines", type=int, metavar="n", help="Number of machines") args = parser.parse_args() @@ -420,6 +430,9 @@ def main(): elif args.testshellvars and args.machines: config = readconfig.read_config(args.config) gen_testmakefile(config, args.testshellvars, args.machines, shellvars=True) + elif args.getnodenames: + config = readconfig.read_config(args.config) + printnodenames(config) elif args.localconfig: localconfig = readconfig.read_config(args.localconfig) config = readconfig.verify_and_read_config(args.config, localconfig["logadminkey"]) diff --git a/tools/genconfig.sh b/tools/genconfig.sh new file mode 100755 index 0000000..89bcd85 --- /dev/null +++ b/tools/genconfig.sh @@ -0,0 +1,43 @@ +#!/bin/sh + +# usage: genconfig.sh