summaryrefslogtreecommitdiffstats
path: root/lavalab-gen.py
diff options
context:
space:
mode:
authorCorentin LABBE <clabbe@baylibre.com>2018-06-13 09:44:26 +0200
committerCorentin LABBE <clabbe@baylibre.com>2018-07-12 14:07:37 +0200
commitede1187c21fbe2d48fa479a9e55d5ce561e0eaee (patch)
tree1db03ec6f949fec0beed27c26baecf16874776b3 /lavalab-gen.py
parent72fce7856928dbae032eee15a1cd5a8b8c9ce384 (diff)
Detect unknown keywords
This patch warnings the user when using lavalab-gen.py with unknow keywords in boards.yaml.
Diffstat (limited to 'lavalab-gen.py')
-rwxr-xr-xlavalab-gen.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/lavalab-gen.py b/lavalab-gen.py
index 83a8a2d..35b10c7 100755
--- a/lavalab-gen.py
+++ b/lavalab-gen.py
@@ -85,6 +85,10 @@ def main():
sys.exit(1)
masters = workers["masters"]
for master in masters:
+ keywords_master = [ "name", "type", "host", "users", "tokens", "webadmin_https" ]
+ for keyword in master:
+ if not keyword in keywords_master:
+ print("WARNING: unknown keyword %s" % keyword)
name = master["name"]
print("Handle %s\n" % name)
if not "host" in master:
@@ -127,6 +131,10 @@ def main():
fsettings.close()
if "users" in worker:
for user in worker["users"]:
+ keywords_users = [ "name", "staff", "superuser", "password", "token" ]
+ for keyword in user:
+ if not keyword in keywords_users:
+ print("WARNING: unknown keyword %s" % keyword)
username = user["name"]
ftok = open("%s/%s" % (userdir, username), "w")
token = user["token"]
@@ -150,6 +158,10 @@ def main():
filename_num = {}
print("Found tokens")
for token in worker["tokens"]:
+ keywords_tokens = [ "username", "token", "description" ]
+ for keyword in token:
+ if not keyword in keywords_tokens:
+ print("WARNING: unknown keyword %s" % keyword)
username = token["username"]
description = token["description"]
if username in filename_num:
@@ -173,6 +185,10 @@ def main():
sys.exit(1)
slaves = workers["slaves"]
for slave in slaves:
+ keywords_slaves = [ "name", "host", "dispatcher_ip", "remote_user", "remote_master", "remote_address", "remote_rpc_port", "remote_proto", "extra_actions" ]
+ for keyword in slave:
+ if not keyword in keywords_slaves:
+ print("WARNING: unknown keyword %s" % keyword)
name = slave["name"]
if len(slaves) == 1:
default_slave = name