Revert "configP"

This reverts commit c2b5375729.
key
Simon 4 years ago
parent c2b5375729
commit bf080f0604

@ -2846,7 +2846,6 @@ if __name__ == '__main__':
if not cli_args.CONFIG_FILE: if not cli_args.CONFIG_FILE:
cli_args.CONFIG_FILE = os.path.dirname(os.path.abspath(__file__))+'/hblink.cfg' cli_args.CONFIG_FILE = os.path.dirname(os.path.abspath(__file__))+'/hblink.cfg'
configP = False
file_exists = os.path.isfile('config.pkl') == True file_exists = os.path.isfile('config.pkl') == True
if file_exists: if file_exists:
if os.path.getmtime('config.pkl') > (time() - 25): if os.path.getmtime('config.pkl') > (time() - 25):
@ -2854,7 +2853,6 @@ if __name__ == '__main__':
with open('config.pkl','rb') as _fh: with open('config.pkl','rb') as _fh:
CONFIG = pickle.load(_fh) CONFIG = pickle.load(_fh)
print('(CONFIG) loaded config .pkl from previous shutdown') print('(CONFIG) loaded config .pkl from previous shutdown')
configP = True
except: except:
print('(CONFIG) Cannot load config.pkl file') print('(CONFIG) Cannot load config.pkl file')
CONFIG = config.build_config(cli_args.CONFIG_FILE) CONFIG = config.build_config(cli_args.CONFIG_FILE)
@ -2882,7 +2880,7 @@ if __name__ == '__main__':
SQLCONFIG = {} SQLCONFIG = {}
sql = useMYSQL(CONFIG['MYSQL']['SERVER'], CONFIG['MYSQL']['USER'], CONFIG['MYSQL']['PASS'], CONFIG['MYSQL']['DB'],CONFIG['MYSQL']['TABLE'],logger) sql = useMYSQL(CONFIG['MYSQL']['SERVER'], CONFIG['MYSQL']['USER'], CONFIG['MYSQL']['PASS'], CONFIG['MYSQL']['DB'],CONFIG['MYSQL']['TABLE'],logger)
#Run it once immediately #Run it once immediately
if sql.con() and not configP: if sql.con() and os.path.getmtime('config.pkl') < (time() - 25):
logger.info('(MYSQL) reading config from database') logger.info('(MYSQL) reading config from database')
try: try:
SQLCONFIG = sql.getConfig() SQLCONFIG = sql.getConfig()

Loading…
Cancel
Save

Powered by TurnKey Linux.