def updates_tail(_context, request): logger.info("Tailing log file ...") sequence = request.matchdict.get('sequence') rollback = request.matchdict.get('rollback', '') logger.debug('admins.py ::: updates_tail - sequence = %s' % sequence) logger.debug('admins.py ::: updates_tail - rollback = %s' % rollback) if rollback == 'rollback' and request.db.updates.find_one({ '_id': sequence }).get('rollback', 0) == 0: # Update mongo document request.db.updates.update_one({'_id': sequence}, { '$set': { 'rollback': 1, 'timestamp_rollback': int(time.time()), 'rolluser': request.user['username'] } }) # Celery task script_runner.delay(request.user, sequence, rollback=True) return { 'websockets_enabled': json.dumps(is_websockets_enabled()), 'request': request, 'sequence': sequence, 'rollback': rollback }
def home(context, request): debug_mode_timeout = get_setting('debug_mode_timeout', get_current_registry().settings, request.db) if debug_mode_timeout is None: logger.warning( 'Please define a debug_mode_timeout in the gecoscc.ini file!') debug_mode_timeout = 24 # 24 hours debug_mode_timeout = int(debug_mode_timeout) * 60 * 60 return { 'websockets_enabled': json.dumps(is_websockets_enabled()), 'update_error_interval': get_setting('update_error_interval', get_current_registry().settings, request.db), 'debug_mode_timeout': debug_mode_timeout, 'printer_type': PRINTER_TYPE, 'printer_conn_type': PRINTER_CONN_TYPE, 'printer_oppolicy_type': PRINTER_OPPOLICY_TYPE }
def home(context, request): return { 'websockets_enabled': json.dumps(is_websockets_enabled()), 'update_error_interval': get_setting('update_error_interval', get_current_registry().settings, request.db) }
def home(context, request): return { 'websockets_enabled': json.dumps(is_websockets_enabled()), 'update_error_interval': get_setting('update_error_interval', get_current_registry().settings, request.db), 'printer_type': PRINTER_TYPE, 'printer_conn_type': PRINTER_CONN_TYPE, 'printer_oppolicy_type': PRINTER_OPPOLICY_TYPE }
def updates_tail(_context, request): logger.info("Tailing log file ...") sequence = request.matchdict.get('sequence') rollback = request.matchdict.get('rollback', '') logger.debug('admins.py ::: updates_tail - sequence = %s' % sequence) logger.debug('admins.py ::: updates_tail - rollback = %s' % rollback) if rollback == 'rollback' and request.db.updates.find_one({'_id': sequence}).get('rollback', 0) == 0: # Update mongo document request.db.updates.update({'_id':sequence},{'$set':{'rollback':1, 'timestamp_rollback': int(time.time()), 'rolluser': request.user['username']}}) # Celery task script_runner.delay(request.user, sequence, rollback=True) return { 'websockets_enabled': json.dumps(is_websockets_enabled()), 'request': request, 'sequence': sequence, 'rollback': rollback }