merge fix
This commit is contained in:
commit
b5de8381f6
18
surok.py
18
surok.py
@ -8,6 +8,7 @@ from surok.templates import gen
|
|||||||
from surok.discovery import resolve
|
from surok.discovery import resolve
|
||||||
from surok.system import reload_conf
|
from surok.system import reload_conf
|
||||||
|
|
||||||
|
import argparse
|
||||||
|
|
||||||
# Load base configurations
|
# Load base configurations
|
||||||
surok_conf = '/etc/surok/conf/surok.json'
|
surok_conf = '/etc/surok/conf/surok.json'
|
||||||
@ -27,14 +28,14 @@ f.close()
|
|||||||
|
|
||||||
# Get app configurations
|
# Get app configurations
|
||||||
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
|
||||||
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
|
||||||
@ -45,12 +46,17 @@ while 1:
|
|||||||
confs = get_configs()
|
confs = get_configs()
|
||||||
for app in confs:
|
for app in confs:
|
||||||
app_conf = load_app_conf(app)
|
app_conf = load_app_conf(app)
|
||||||
|
|
||||||
|
# Resolve services
|
||||||
app_hosts = resolve(app_conf, conf)
|
app_hosts = resolve(app_conf, conf)
|
||||||
my = { 'services': app_hosts }
|
|
||||||
|
# Populate my dictionary
|
||||||
|
my = { "services": app_hosts }
|
||||||
|
|
||||||
service_conf = gen(my, app_conf['template'])
|
service_conf = gen(my, app_conf['template'])
|
||||||
|
|
||||||
print(reload_conf(service_conf, app_conf))
|
print( reload_conf(service_conf, app_conf) )
|
||||||
|
|
||||||
|
|
||||||
sleep(conf['wait_time'])
|
sleep( conf['wait_time'] )
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user