Skip to content

Commit ca08bc4

Browse files
committed
webui: don't re-use the manager reload_config function
It does some logging which causes permission errors, it is misleading because it logs as the manager, etc.
1 parent 7372f93 commit ca08bc4

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

resallocwebui/app.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
import os
1+
import yaml
22
from flask import Flask, render_template
33
from resallocserver.app import session_scope
44
from resallocserver.logic import QResources
55
from resallocserver import models
6-
from resallocserver.manager import reload_config
76
from resalloc.helpers import RState
87
from resallocwebui import staticdir, templatedir
98

@@ -12,6 +11,15 @@
1211
app.static_folder = staticdir
1312

1413

14+
def load_config():
15+
try:
16+
config_file = "/etc/resallocserver/pools.yaml"
17+
with open(config_file, "r") as fp:
18+
return yaml.safe_load(fp)
19+
except OSError:
20+
return {}
21+
22+
1523
@app.route("/")
1624
def home():
1725
return render_template("home.html", resources=resources)
@@ -38,7 +46,7 @@ def pools():
3846
# e.g. result["copr_hv_x86_64_01_prod"]["STARTING"]
3947
result = {}
4048

41-
_, pools_from_config = reload_config()
49+
pools_from_config = load_config()
4250

4351
# Prepare the two-dimensional array, and fill it with zeros
4452
with session_scope() as session:
@@ -50,7 +58,7 @@ def pools():
5058
continue
5159

5260
result[pool.name]["DESCRIPTION"] =\
53-
pools_from_config[pool.name].description
61+
pools_from_config[pool.name]["description"]
5462

5563
with session_scope() as session:
5664
# Iterate over running resources and calculate how many is starting,

0 commit comments

Comments
 (0)