aboutsummaryrefslogtreecommitdiffstats
path: root/lavalab-gen.py
diff options
context:
space:
mode:
authorCorentin LABBE <clabbe@baylibre.com>2018-01-09 10:41:42 +0100
committerCorentin LABBE <clabbe@baylibre.com>2018-01-09 10:41:42 +0100
commit01f55d2fd3ea0e9620bb631dd91e475444393099 (patch)
tree8ba7d5048778d8335c4444584d68ca96e352266a /lavalab-gen.py
parentc856c35e30f4465f8d14834d672a0dcbf06567fb (diff)
Permit to create staff/superuser users
This patch add two user options staff and superuser. This will permit to create users with thoses flag in LAVA. In the process remove the hardcoded admin user from Dockerfile and move it in tokens.yaml
Diffstat (limited to 'lavalab-gen.py')
-rwxr-xr-xlavalab-gen.py11
1 files changed, 10 insertions, 1 deletions
diff --git a/lavalab-gen.py b/lavalab-gen.py
index 64a4b0b..e5f5db0 100755
--- a/lavalab-gen.py
+++ b/lavalab-gen.py
@@ -120,7 +120,16 @@ def main(args):
ftok.write("TOKEN=" + token + "\n")
if user.has_key("password"):
password = user["password"]
- ftok.write("PASSWORD=" + password)
+ ftok.write("PASSWORD=" + password + "\n")
+ # libyaml convert yes/no to true/false...
+ if user.has_key("staff"):
+ value = user["staff"]
+ if value is True:
+ ftok.write("STAFF=1\n")
+ if user.has_key("superuser"):
+ value = user["superuser"]
+ if value is True:
+ ftok.write("SUPERUSER=1\n")
ftok.close()
if section_name == "callback_tokens":
for token in section: