1- import os
1+ import yaml
22from flask import Flask , render_template
33from resallocserver .app import session_scope
44from resallocserver .logic import QResources
55from resallocserver import models
6- from resallocserver .manager import reload_config
76from resalloc .helpers import RState
87from resallocwebui import staticdir , templatedir
98
1211app .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 ("/" )
1624def 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