diff options
author | Corentin LABBE <clabbe@baylibre.com> | 2019-01-08 14:33:27 +0100 |
---|---|---|
committer | Corentin LABBE <clabbe@baylibre.com> | 2019-01-14 14:22:05 +0100 |
commit | e9c7827af4a9f8e52b8f0df04365808298d08c0a (patch) | |
tree | 1bcb451b8365a21b7b066a5d2d28df15eb5b0df3 | |
parent | f3d0e211a5b7c4fca8221e22631266d283209e78 (diff) |
Permit to choose loglevel
By default, all process use the DEBUG loglevel, this could be too much
for a production server.
This patch permits to tune the loglevel.
-rw-r--r-- | README.md | 5 | ||||
-rw-r--r-- | lava-master/Dockerfile | 2 | ||||
-rw-r--r-- | lava-master/default/.empty | 0 | ||||
-rw-r--r-- | lava-slave/Dockerfile | 2 | ||||
-rw-r--r-- | lava-slave/default/.empty | 0 | ||||
-rwxr-xr-x | lavalab-gen.py | 28 |
6 files changed, 35 insertions, 2 deletions
@@ -221,6 +221,11 @@ masters: slave_keys: optional path to a directory with slaves public key. Usefull when you want to create a master without slaves nodes in boards.yaml. persistent_db: True/False (default False) Is the postgres DB is persistent over reboot http_fqdn: The FQDN used to access the LAVA web interface. This is necessary if you use https otherwise you will issue CSRF errors. + loglevel: + lava-logs: DEBUG/INFO/WARN/ERROR (optional) select the loglevel of lava-logs (default to DEBUG) + lava-slave: DEBUG/INFO/WARN/ERROR (optional) select the loglevel of lava-slave (default to DEBUG) + lava-master: DEBUG/INFO/WARN/ERROR (optional) select the loglevel of lava-master (default to DEBUG) + lava-server-gunicorn: DEBUG/INFO/WARN/ERROR (optional) select the loglevel of lava-server-gunicorn (default to DEBUG) users: - name: LAVA username token: The token of this user (optional) diff --git a/lava-master/Dockerfile b/lava-master/Dockerfile index b41446f..5d2a119 100644 --- a/lava-master/Dockerfile +++ b/lava-master/Dockerfile @@ -4,6 +4,8 @@ COPY backup /root/backup/ COPY configs/tftpd-hpa /etc/default/tftpd-hpa +COPY default/* /etc/default/ + RUN git clone https://github.com/BayLibre/lava-healthchecks.git RUN cp lava-healthchecks/health-checks/* /etc/lava-server/dispatcher-config/health-checks/ COPY health-checks/* /etc/lava-server/dispatcher-config/health-checks/ diff --git a/lava-master/default/.empty b/lava-master/default/.empty new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/lava-master/default/.empty diff --git a/lava-slave/Dockerfile b/lava-slave/Dockerfile index 5850208..7cb607b 100644 --- a/lava-slave/Dockerfile +++ b/lava-slave/Dockerfile @@ -34,6 +34,8 @@ RUN apt-get update RUN apt-get -y install lavacli +COPY default/* /etc/default/ + COPY phyhostname /root/ COPY scripts/setup.sh . diff --git a/lava-slave/default/.empty b/lava-slave/default/.empty new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/lava-slave/default/.empty diff --git a/lavalab-gen.py b/lavalab-gen.py index 378f40c..d6c2b75 100755 --- a/lavalab-gen.py +++ b/lavalab-gen.py @@ -94,7 +94,7 @@ def main(): else: masters = workers["masters"] for master in masters: - keywords_master = [ "name", "type", "host", "users", "groups", "tokens", "webadmin_https", "persistent_db", "zmq_auth", "zmq_auth_key", "zmq_auth_key_secret", "http_fqdn", "slave_keys", "slaveenv" ] + keywords_master = [ "name", "type", "host", "users", "groups", "tokens", "webadmin_https", "persistent_db", "zmq_auth", "zmq_auth_key", "zmq_auth_key_secret", "http_fqdn", "slave_keys", "slaveenv", "loglevel" ] for keyword in master: if not keyword in keywords_master: print("WARNING: unknown keyword %s" % keyword) @@ -254,6 +254,18 @@ def main(): for line in slaveenv["env"]: fenv.write(" %s\n" % line) fenv.close() + if "loglevel" in worker: + for component in worker["loglevel"]: + if component != "lava-master" and component != "lava-logs" and component != 'lava-server-gunicorn': + print("ERROR: invalid loglevel component %s" % component) + sys.exit(1) + loglevel = worker["loglevel"][component] + if loglevel != 'DEBUG' and loglevel != 'INFO' and loglevel != 'WARN' and loglevel != 'ERROR': + print("ERROR: invalid loglevel %s for %s" % (loglevel, component)) + sys.exit(1) + fcomponent = open("%s/default/%s" % (workerdir, component), 'w') + fcomponent.write("LOGLEVEL=%s\n" % loglevel) + fcomponent.close() default_slave = "lab-slave-0" if "slaves" not in workers: @@ -261,7 +273,7 @@ def main(): else: 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", "zmq_auth_key", "zmq_auth_key_secret", "default_slave", "export_ser2net", "expose_ser2net", "remote_user_token", "zmq_auth_master_key", "expose_ports", "env", "bind_dev" ] + keywords_slaves = [ "name", "host", "dispatcher_ip", "remote_user", "remote_master", "remote_address", "remote_rpc_port", "remote_proto", "extra_actions", "zmq_auth_key", "zmq_auth_key_secret", "default_slave", "export_ser2net", "expose_ser2net", "remote_user_token", "zmq_auth_master_key", "expose_ports", "env", "bind_dev", "loglevel" ] for keyword in slave: if not keyword in keywords_slaves: print("WARNING: unknown keyword %s" % keyword) @@ -393,6 +405,18 @@ def main(): fp.write("\n") fp.close() os.chmod("%s/scripts/extra_actions" % workerdir, 0o755) + if "loglevel" in worker: + for component in worker["loglevel"]: + if component != "lava-slave": + print("ERROR: invalid loglevel component %s" % component) + sys.exit(1) + loglevel = worker["loglevel"][component] + if loglevel != 'DEBUG' and loglevel != 'INFO' and loglevel != 'WARN' and loglevel != 'ERROR': + print("ERROR: invalid loglevel %s for %s" % (loglevel, component)) + sys.exit(1) + fcomponent = open("%s/default/%s" % (workerdir, component), 'w') + fcomponent.write("LOGLEVEL=%s\n" % loglevel) + fcomponent.close() if "boards" not in workers: boards = {} |