2
0
mirror of https://github.com/frappe/bench.git synced 2025-01-27 00:08:24 +00:00

fallback in case redis isnt running

This commit is contained in:
Achilles Rasquinha 2018-03-25 13:41:34 +05:30
parent 84c5719bc4
commit d99adf0b28
2 changed files with 15 additions and 12 deletions

View File

@ -95,19 +95,22 @@ def migrate_env(python, no_backup = False):
""" """
Migrate Virtual Environment to desired Python Version. Migrate Virtual Environment to desired Python Version.
""" """
# Clear Cache before Bench Dies. try:
config = get_config(bench_path = os.getcwd()) # Clear Cache before Bench Dies.
rredis = urlparse(config['redis_cache']) config = get_config(bench_path = os.getcwd())
rredis = urlparse(config['redis_cache'])
redis = '{redis} -p {port}'.format( redis = '{redis} -p {port}'.format(
redis = which('redis-cli'), redis = which('redis-cli'),
port = rredis.port port = rredis.port
) )
log.debug('Clearing Redis Cache...') log.debug('Clearing Redis Cache...')
exec_cmd('{redis} FLUSHALL'.format(redis = redis)) exec_cmd('{redis} FLUSHALL'.format(redis = redis))
log.debug('Clearing Redis DataBase...') log.debug('Clearing Redis DataBase...')
exec_cmd('{redis} FLUSHDB'.format(redis = redis)) exec_cmd('{redis} FLUSHDB'.format(redis = redis))
except Exception:
log.warn('Please ensure Redis Connections are running or Daemonized.')
try: try:
# This is with the assumption that a bench is set-up within path. # This is with the assumption that a bench is set-up within path.