PEP8
This commit is contained in:
parent
4b2000c451
commit
4766ad74ee
26
surok.py
26
surok.py
@ -2,7 +2,7 @@
|
||||
|
||||
from time import sleep
|
||||
from os import listdir
|
||||
from os.path import isfile, join
|
||||
from os.path import isfile, join
|
||||
import json
|
||||
from surok.templates import gen
|
||||
from surok.discovery import resolve
|
||||
@ -30,15 +30,16 @@ f.close()
|
||||
# Get app configurations
|
||||
# Return list of patches to app discovery configuration
|
||||
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
|
||||
|
||||
|
||||
# Get Surok App configuration
|
||||
# Read app conf from file and return dict
|
||||
def load_app_conf(app):
|
||||
f = open( conf['confd'] + '/' + app )
|
||||
c = json.loads( f.read() )
|
||||
f = open(conf['confd'] + '/' + app)
|
||||
c = json.loads(f.read())
|
||||
f.close()
|
||||
|
||||
return c
|
||||
@ -56,20 +57,17 @@ while 1:
|
||||
for app in confs:
|
||||
app_conf = load_app_conf(app)
|
||||
|
||||
# Resolve services
|
||||
# Resolve services
|
||||
app_hosts = resolve(app_conf, conf)
|
||||
|
||||
# Populate my dictionary
|
||||
my = { "services": app_hosts,
|
||||
"conf_name": app_conf['conf_name']
|
||||
}
|
||||
|
||||
# Generate config from template
|
||||
my = {"services": app_hosts,
|
||||
"conf_name": app_conf['conf_name']}
|
||||
|
||||
# Generate config from template
|
||||
service_conf = gen(my, app_conf['template'])
|
||||
|
||||
stdout, first = reload_conf(service_conf, app_conf, first)
|
||||
stdout, first = reload_conf(service_conf, app_conf, first)
|
||||
print(stdout)
|
||||
|
||||
|
||||
sleep( conf['wait_time'] )
|
||||
|
||||
sleep(conf['wait_time'])
|
||||
|
Loading…
Reference in New Issue
Block a user