This commit is contained in:
Difrex 2016-08-09 14:13:20 +03:00
parent 4b2000c451
commit 4766ad74ee

View File

@ -30,15 +30,16 @@ f.close()
# Get app configurations # Get app configurations
# Return list of patches to app discovery configuration # Return list of patches to app discovery configuration
def get_configs(): def get_configs():
confs = [f for f in listdir(conf['confd']) if isfile( join(conf['confd'], f) )] confs = [f for f in listdir(conf['confd']) if isfile(
join(conf['confd'], f))]
return confs return confs
# Get Surok App configuration # Get Surok App configuration
# Read app conf from file and return dict # Read app conf from file and return dict
def load_app_conf(app): def load_app_conf(app):
f = open( conf['confd'] + '/' + app ) f = open(conf['confd'] + '/' + app)
c = json.loads( f.read() ) c = json.loads(f.read())
f.close() f.close()
return c return c
@ -60,9 +61,8 @@ while 1:
app_hosts = resolve(app_conf, conf) app_hosts = resolve(app_conf, conf)
# Populate my dictionary # Populate my dictionary
my = { "services": app_hosts, my = {"services": app_hosts,
"conf_name": app_conf['conf_name'] "conf_name": app_conf['conf_name']}
}
# Generate config from template # Generate config from template
service_conf = gen(my, app_conf['template']) service_conf = gen(my, app_conf['template'])
@ -70,6 +70,4 @@ while 1:
stdout, first = reload_conf(service_conf, app_conf, first) stdout, first = reload_conf(service_conf, app_conf, first)
print(stdout) print(stdout)
sleep(conf['wait_time'])
sleep( conf['wait_time'] )