Fallback to files if memcached is down
This commit is contained in:
parent
d5b448b133
commit
b261486c76
@ -68,14 +68,6 @@ def do_reload(service_conf, app_conf):
|
|||||||
|
|
||||||
# !!! NEED REFACTORING !!!
|
# !!! NEED REFACTORING !!!
|
||||||
def reload_conf(service_conf, app_conf, conf, app_hosts):
|
def reload_conf(service_conf, app_conf, conf, app_hosts):
|
||||||
|
|
||||||
# Check first loop
|
|
||||||
#if first is True:
|
|
||||||
# stdout = do_reload(service_conf, app_conf)
|
|
||||||
# first = False
|
|
||||||
# logging.info(stdout)
|
|
||||||
# return first
|
|
||||||
|
|
||||||
# Check marathon enabled in configuration
|
# Check marathon enabled in configuration
|
||||||
if conf['marathon']['enabled'] is True:
|
if conf['marathon']['enabled'] is True:
|
||||||
if get_old(app_conf['conf_name'], service_conf) != 1:
|
if get_old(app_conf['conf_name'], service_conf) != 1:
|
||||||
@ -88,13 +80,15 @@ def reload_conf(service_conf, app_conf, conf, app_hosts):
|
|||||||
if conf['memcached']['enabled'] is True:
|
if conf['memcached']['enabled'] is True:
|
||||||
# Check old servers
|
# Check old servers
|
||||||
if conf['memcached']['discovery']['enabled'] is True:
|
if conf['memcached']['discovery']['enabled'] is True:
|
||||||
logging.warning('Discovery of Memcached not implemented')
|
logging.warning('Discovery of Memcached not implpemented')
|
||||||
|
try:
|
||||||
mc = memcache.Client(conf['memcached']['hosts'])
|
mc = memcache.Client(conf['memcached']['hosts'])
|
||||||
if get_old_from_memcache(mc, app_conf['conf_name'], service_conf) != 1:
|
if get_old_from_memcache(mc, app_conf['conf_name'], service_conf) != 1:
|
||||||
stdout = do_reload(service_conf, app_conf)
|
stdout = do_reload(service_conf, app_conf)
|
||||||
logging.info(stdout)
|
logging.info(stdout)
|
||||||
return True
|
return True
|
||||||
|
except Exception as e:
|
||||||
|
logging.error('Cannot connect to memcached: ' + str(e))
|
||||||
|
|
||||||
else:
|
else:
|
||||||
logging.warning('DEPRECATED main conf file. Please use new syntax!')
|
logging.warning('DEPRECATED main conf file. Please use new syntax!')
|
||||||
@ -130,4 +124,3 @@ def restart_self_in_marathon(marathon):
|
|||||||
r = requests.post(uri, data = {'force': 'true'})
|
r = requests.post(uri, data = {'force': 'true'})
|
||||||
else:
|
else:
|
||||||
r = requests.post(uri, data = {'force': 'false'})
|
r = requests.post(uri, data = {'force': 'false'})
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user