replace logging.warn with warning
call is deprected in python 3.7 Fixes: https://pagure.io/koji/issue/2135
This commit is contained in:
parent
ef0730f5d5
commit
0132313f92
13 changed files with 63 additions and 62 deletions
|
|
@ -146,7 +146,7 @@ def main(options, session):
|
|||
raise SystemExit
|
||||
|
||||
def restart(*args):
|
||||
logger.warn("Initiating graceful restart")
|
||||
logger.warning("Initiating graceful restart")
|
||||
tm.restart_pending = True
|
||||
signal.signal(signal.SIGTERM, shutdown)
|
||||
signal.signal(signal.SIGUSR1, restart)
|
||||
|
|
@ -157,10 +157,10 @@ def main(options, session):
|
|||
tm.updateTasks()
|
||||
taken = tm.getNextTask()
|
||||
except (SystemExit, ServerExit, KeyboardInterrupt):
|
||||
logger.warn("Exiting")
|
||||
logger.warning("Exiting")
|
||||
break
|
||||
except ServerRestart:
|
||||
logger.warn("Restarting")
|
||||
logger.warning("Restarting")
|
||||
os.execv(sys.argv[0], sys.argv)
|
||||
except koji.AuthExpired:
|
||||
logger.error('Session expired')
|
||||
|
|
@ -178,9 +178,9 @@ def main(options, session):
|
|||
# from getting overloaded.
|
||||
time.sleep(options.sleeptime)
|
||||
except (SystemExit, KeyboardInterrupt):
|
||||
logger.warn("Exiting")
|
||||
logger.warning("Exiting")
|
||||
break
|
||||
logger.warn("Shutting down, please wait...")
|
||||
logger.warning("Shutting down, please wait...")
|
||||
tm.shutdown()
|
||||
session.logout()
|
||||
sys.exit(0)
|
||||
|
|
@ -1340,7 +1340,7 @@ class BuildArchTask(BaseBuildTask):
|
|||
if not avg:
|
||||
return
|
||||
if avg < 0:
|
||||
self.logger.warn("Negative average build duration for %s: %s", name, avg)
|
||||
self.logger.warning("Negative average build duration for %s: %s", name, avg)
|
||||
return
|
||||
# increase the task weight by 0.75 for every hour of build duration
|
||||
adj = avg / 4800.0
|
||||
|
|
@ -5454,7 +5454,7 @@ class CreaterepoTask(BaseTaskHandler):
|
|||
oldpath = self.pathinfo.repo(oldrepo['id'], oldrepo['tag_name'])
|
||||
olddatadir = '%s/%s/repodata' % (oldpath, arch)
|
||||
if not os.path.isdir(olddatadir):
|
||||
self.logger.warn("old repodata is missing: %s" % olddatadir)
|
||||
self.logger.warning("old repodata is missing: %s" % olddatadir)
|
||||
else:
|
||||
shutil.copytree(olddatadir, self.datadir)
|
||||
oldorigins = os.path.join(self.datadir, 'pkgorigins.gz')
|
||||
|
|
@ -5754,7 +5754,7 @@ class createDistRepoTask(BaseTaskHandler):
|
|||
cmd.extend(['-g', groupdata])
|
||||
if pkglist and oldrepodata and self.options.createrepo_update:
|
||||
if not os.path.isdir(oldrepodata):
|
||||
self.logger.warn("old repodata is missing: %s" % oldrepodata)
|
||||
self.logger.warning("old repodata is missing: %s" % oldrepodata)
|
||||
else:
|
||||
datadir = os.path.join(repodir, 'repodata')
|
||||
shutil.copytree(oldrepodata, datadir)
|
||||
|
|
|
|||
|
|
@ -5582,7 +5582,7 @@ def ensure_volume_symlink(binfo):
|
|||
# basic checks
|
||||
volname = binfo.get('volume_name')
|
||||
if volname is None:
|
||||
logger.warn('buildinfo has no volume data, cannot create symlink')
|
||||
logger.warning('buildinfo has no volume data, cannot create symlink')
|
||||
return
|
||||
if volname == 'DEFAULT':
|
||||
# nothing to do
|
||||
|
|
@ -5652,7 +5652,7 @@ def check_volume_policy(data, strict=False, default=None):
|
|||
logger.error('Invalid default volume: %s', default)
|
||||
if strict:
|
||||
raise koji.GenericError('No volume policy match')
|
||||
logger.warn('No volume policy match')
|
||||
logger.warning('No volume policy match')
|
||||
return None
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -2478,7 +2478,7 @@ class ClientSession(object):
|
|||
sinfo = dict(zip(['session-id', 'session-key'], sinfo_str.split()))
|
||||
|
||||
if not sinfo:
|
||||
self.logger.warn('No session info received')
|
||||
self.logger.warning('No session info received')
|
||||
return False
|
||||
self.setSession(sinfo)
|
||||
|
||||
|
|
|
|||
|
|
@ -364,8 +364,8 @@ class SCM(object):
|
|||
for allowed_scm in allowed.split():
|
||||
scm_tuple = allowed_scm.split(':')
|
||||
if len(scm_tuple) < 2:
|
||||
self.logger.warn('Ignoring incorrectly formatted SCM host:repository: %s' %
|
||||
allowed_scm)
|
||||
self.logger.warning('Ignoring incorrectly formatted SCM host:repository: %s' %
|
||||
allowed_scm)
|
||||
continue
|
||||
host_pat = scm_tuple[0]
|
||||
repo_pat = scm_tuple[1]
|
||||
|
|
@ -656,7 +656,8 @@ class TaskManager(object):
|
|||
if task_id is None:
|
||||
# not associated with a task
|
||||
# this makes no sense now, but may in the future
|
||||
self.logger.warn("Expiring taskless buildroot: %(id)i/%(tag_name)s/%(arch)s" % br)
|
||||
self.logger.warning("Expiring taskless buildroot: %(id)i/%(tag_name)s/%(arch)s" %
|
||||
br)
|
||||
self.session.host.setBuildRootState(id, st_expired)
|
||||
elif task_id not in self.tasks:
|
||||
# task not running - expire the buildroot
|
||||
|
|
@ -692,18 +693,18 @@ class TaskManager(object):
|
|||
data = local_br[id]
|
||||
br = missed_br.get(id)
|
||||
if not br:
|
||||
self.logger.warn("%(name)s: not in db" % data)
|
||||
self.logger.warning("%(name)s: not in db" % data)
|
||||
continue
|
||||
desc = "%(id)i/%(tag_name)s/%(arch)s" % br
|
||||
if not br['retire_ts']:
|
||||
self.logger.warn("%s: no retire timestamp" % desc)
|
||||
self.logger.warning("%s: no retire timestamp" % desc)
|
||||
continue
|
||||
age = time.time() - br['retire_ts']
|
||||
self.logger.debug("Expired/stray buildroot: %s" % desc)
|
||||
if br and br['task_id']:
|
||||
task = tasks.get(br['task_id'])
|
||||
if not task:
|
||||
self.logger.warn("%s: invalid task %s" % (desc, br['task_id']))
|
||||
self.logger.warning("%s: invalid task %s" % (desc, br['task_id']))
|
||||
continue
|
||||
if task['state'] == koji.TASK_STATES['FAILED'] and \
|
||||
age < self.options.failed_buildroot_lifetime:
|
||||
|
|
@ -723,7 +724,7 @@ class TaskManager(object):
|
|||
if e.errno == errno.ENOENT:
|
||||
rootdir = None
|
||||
else:
|
||||
self.logger.warn("%s: %s" % (desc, e))
|
||||
self.logger.warning("%s: %s" % (desc, e))
|
||||
continue
|
||||
else:
|
||||
age = min(age, time.time() - st.st_mtime)
|
||||
|
|
@ -741,13 +742,13 @@ class TaskManager(object):
|
|||
try:
|
||||
os.unlink(data['cfg'])
|
||||
except OSError as e:
|
||||
self.logger.warn("%s: can't remove config: %s" % (desc, e))
|
||||
self.logger.warning("%s: can't remove config: %s" % (desc, e))
|
||||
elif age > 120:
|
||||
if rootdir:
|
||||
try:
|
||||
flist = os.listdir(rootdir)
|
||||
except OSError as e:
|
||||
self.logger.warn("%s: can't list rootdir: %s" % (desc, e))
|
||||
self.logger.warning("%s: can't list rootdir: %s" % (desc, e))
|
||||
continue
|
||||
if flist:
|
||||
self.logger.info("%s: clearing rootdir" % desc)
|
||||
|
|
@ -916,7 +917,7 @@ class TaskManager(object):
|
|||
# note: tasks are in priority order
|
||||
self.logger.debug("task: %r" % task)
|
||||
if task['method'] not in self.handlers:
|
||||
self.logger.warn("Skipping task %(id)i, no handler for method %(method)s", task)
|
||||
self.logger.warning("Skipping task %(id)i, no handler for method %(method)s", task)
|
||||
continue
|
||||
if task['id'] in self.tasks:
|
||||
# we were running this task, but it apparently has been
|
||||
|
|
@ -1042,8 +1043,8 @@ class TaskManager(object):
|
|||
return True
|
||||
|
||||
if t >= timeout:
|
||||
self.logger.warn('Failed to kill %s (pid %i, taskID %i) with signal %i' %
|
||||
(execname, pid, task_id, sig))
|
||||
self.logger.warning('Failed to kill %s (pid %i, taskID %i) with signal %i' %
|
||||
(execname, pid, task_id, sig))
|
||||
return False
|
||||
|
||||
try:
|
||||
|
|
@ -1189,7 +1190,7 @@ class TaskManager(object):
|
|||
if availableMB < self.options.minspace:
|
||||
self.status = "Insufficient disk space at %s: %i MB, %i MB required" % \
|
||||
(br_path, availableMB, self.options.minspace)
|
||||
self.logger.warn(self.status)
|
||||
self.logger.warning(self.status)
|
||||
return False
|
||||
return True
|
||||
|
||||
|
|
@ -1260,7 +1261,7 @@ class TaskManager(object):
|
|||
raise koji.GenericError("No handler found for method '%s'" % method)
|
||||
task_info = self.session.getTaskInfo(task['id'], request=True)
|
||||
if task_info.get('request') is None:
|
||||
self.logger.warn("Task '%s' has no request" % task['id'])
|
||||
self.logger.warning("Task '%s' has no request" % task['id'])
|
||||
return False
|
||||
params = task_info['request']
|
||||
handler = handlerClass(task_info['id'], method, params, self.session, self.options)
|
||||
|
|
@ -1271,15 +1272,15 @@ class TaskManager(object):
|
|||
raise
|
||||
except Exception:
|
||||
valid_host = False
|
||||
self.logger.warn('Error during host check')
|
||||
self.logger.warn(''.join(traceback.format_exception(*sys.exc_info())))
|
||||
self.logger.warning('Error during host check')
|
||||
self.logger.warning(''.join(traceback.format_exception(*sys.exc_info())))
|
||||
if not valid_host:
|
||||
self.logger.info(
|
||||
'Skipping task %s (%s) due to host check', task['id'], task['method'])
|
||||
return False
|
||||
data = self.session.host.openTask(task['id'])
|
||||
if data is None:
|
||||
self.logger.warn("Could not open")
|
||||
self.logger.warning("Could not open")
|
||||
return False
|
||||
task_id = data['id']
|
||||
self.tasks[task_id] = data
|
||||
|
|
@ -1289,11 +1290,11 @@ class TaskManager(object):
|
|||
except koji.ActionNotAllowed:
|
||||
info2 = self.session.getTaskInfo(task['id'])
|
||||
if info2['host_id'] != self.host_id:
|
||||
self.logger.warn("Task %i was reassigned", task_id)
|
||||
self.logger.warning("Task %i was reassigned", task_id)
|
||||
return False
|
||||
state = koji.TASK_STATES[info2['state']]
|
||||
if state != 'OPEN':
|
||||
self.logger.warn("Task %i changed is %s", task_id, state)
|
||||
self.logger.warning("Task %i changed is %s", task_id, state)
|
||||
return False
|
||||
# otherwise...
|
||||
raise
|
||||
|
|
@ -1345,7 +1346,7 @@ class TaskManager(object):
|
|||
except koji.xmlrpcplus.Fault as fault:
|
||||
response = koji.xmlrpcplus.dumps(fault)
|
||||
tb = ''.join(traceback.format_exception(*sys.exc_info())).replace(r"\n", "\n")
|
||||
self.logger.warn("FAULT:\n%s" % tb)
|
||||
self.logger.warning("FAULT:\n%s" % tb)
|
||||
except (SystemExit, koji.tasks.ServerExit, KeyboardInterrupt):
|
||||
# we do not trap these
|
||||
raise
|
||||
|
|
@ -1355,7 +1356,7 @@ class TaskManager(object):
|
|||
return
|
||||
except Exception:
|
||||
tb = ''.join(traceback.format_exception(*sys.exc_info()))
|
||||
self.logger.warn("TRACEBACK: %s" % tb)
|
||||
self.logger.warning("TRACEBACK: %s" % tb)
|
||||
# report exception back to server
|
||||
e_class, e = sys.exc_info()[:2]
|
||||
faultCode = getattr(e_class, 'faultCode', 1)
|
||||
|
|
|
|||
|
|
@ -202,7 +202,7 @@ def run_callbacks(cbtype, *args, **kws):
|
|||
except Exception:
|
||||
msg = 'Error running %s callback from %s' % (cbtype, func.__module__)
|
||||
if getattr(func, 'failure_is_an_option', False):
|
||||
logging.getLogger('koji.plugin').warn(msg, exc_info=True)
|
||||
logging.getLogger('koji.plugin').warning(msg, exc_info=True)
|
||||
else:
|
||||
tb = ''.join(traceback.format_exception(*sys.exc_info()))
|
||||
raise koji.CallbackError('%s:\n%s' % (msg, tb))
|
||||
|
|
|
|||
|
|
@ -83,7 +83,7 @@ def safe_rmtree(path, unmount=False, strict=True):
|
|||
if strict:
|
||||
raise
|
||||
else:
|
||||
logger.warn("Error removing: %s", exc_info=True)
|
||||
logger.warning("Error removing: %s", exc_info=True)
|
||||
return 1
|
||||
return 0
|
||||
if not os.path.exists(path):
|
||||
|
|
@ -94,7 +94,7 @@ def safe_rmtree(path, unmount=False, strict=True):
|
|||
try:
|
||||
koji.util.rmtree(path)
|
||||
except Exception:
|
||||
logger.warn('file removal failed for %s' % path)
|
||||
logger.warning('file removal failed for %s' % path)
|
||||
if strict:
|
||||
raise
|
||||
return 1
|
||||
|
|
|
|||
|
|
@ -632,7 +632,7 @@ def setup_rlimits(opts, logger=None):
|
|||
continue
|
||||
if len(limits) == 1:
|
||||
limits.append(orig[1])
|
||||
logger.warn('Setting resource limit: %s = %r', key, limits)
|
||||
logger.warning('Setting resource limit: %s = %r', key, limits)
|
||||
try:
|
||||
resource.setrlimit(rcode, tuple(limits))
|
||||
except ValueError as e:
|
||||
|
|
|
|||
|
|
@ -328,7 +328,7 @@ class RunRootTask(koji.tasks.BaseTaskHandler):
|
|||
failed.append("%s: %s" % (dir, output))
|
||||
if failed:
|
||||
msg = "Unable to unmount: %s" % ', '.join(failed)
|
||||
self.logger.warn(msg)
|
||||
self.logger.warning(msg)
|
||||
if fatal:
|
||||
raise koji.GenericError(msg)
|
||||
else:
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ class TestEnsureVolumeSymlink(unittest.TestCase):
|
|||
del self.buildinfo['volume_name']
|
||||
with mock.patch('kojihub.logger') as logger:
|
||||
kojihub.ensure_volume_symlink(self.buildinfo)
|
||||
logger.warn.assert_called_once()
|
||||
logger.warning.assert_called_once()
|
||||
|
||||
def test_volume_symlink_create(self):
|
||||
basedir = self.pathinfo.build(self.buildinfo) # default volume
|
||||
|
|
|
|||
|
|
@ -140,7 +140,7 @@ class TestCallbacks(unittest.TestCase):
|
|||
self.assertEqual(len(self.callbacks), 1)
|
||||
self.assertEqual(self.callbacks[0], [cbtype, args, kwargs])
|
||||
getLogger.assert_called_once()
|
||||
getLogger.return_value.warn.assert_called_once()
|
||||
getLogger.return_value.warning.assert_called_once()
|
||||
|
||||
def test_datetime_callback(self):
|
||||
dt1 = datetime.datetime.now()
|
||||
|
|
|
|||
18
util/kojira
18
util/kojira
|
|
@ -109,7 +109,7 @@ class ManagedRepo(object):
|
|||
return None
|
||||
fn = '%s/repo.json' % path
|
||||
if not os.path.exists(fn):
|
||||
self.logger.warn('Repo info file missing: %s', fn)
|
||||
self.logger.warning('Repo info file missing: %s', fn)
|
||||
return None
|
||||
with open(fn, 'r') as fp:
|
||||
return json.load(fp)
|
||||
|
|
@ -120,8 +120,8 @@ class ManagedRepo(object):
|
|||
if not tag_info:
|
||||
tag_info = getTag(self.session, self.tag_id, self.event_id)
|
||||
if not tag_info:
|
||||
self.logger.warn('Could not get info for tag %i, referenced by repo %i' %
|
||||
(self.tag_id, self.repo_id))
|
||||
self.logger.warning('Could not get info for tag %i, referenced by repo %i' %
|
||||
(self.tag_id, self.repo_id))
|
||||
return None
|
||||
tag_name = tag_info['name']
|
||||
if self.dist:
|
||||
|
|
@ -526,7 +526,7 @@ class RepoManager(object):
|
|||
self.logger.debug("%s doesn't exist, skipping", topdir)
|
||||
return
|
||||
if not os.path.isdir(topdir):
|
||||
self.logger.warn("%s is not directory, skipping", topdir)
|
||||
self.logger.warning("%s is not directory, skipping", topdir)
|
||||
return
|
||||
self.logger.debug("Scanning %s for repos", topdir)
|
||||
self.logger.debug('max age allowed: %s seconds', max_age)
|
||||
|
|
@ -577,7 +577,7 @@ class RepoManager(object):
|
|||
self.rmtree(repodir)
|
||||
continue
|
||||
if rinfo['tag_name'] != tag:
|
||||
self.logger.warn(
|
||||
self.logger.warning(
|
||||
"Tag name mismatch (rename?): %s vs %s", tag, rinfo['tag_name'])
|
||||
continue
|
||||
if rinfo['state'] in (koji.REPO_DELETED, koji.REPO_PROBLEM):
|
||||
|
|
@ -938,13 +938,13 @@ def main(options, session):
|
|||
logger.error("Regeneration thread died. Restarting it.")
|
||||
regen_thread = start_regen_loop(session, repomgr)
|
||||
except KeyboardInterrupt:
|
||||
logger.warn("User exit")
|
||||
logger.warning("User exit")
|
||||
break
|
||||
except koji.AuthExpired:
|
||||
logger.warn("Session expired")
|
||||
logger.warning("Session expired")
|
||||
break
|
||||
except SystemExit:
|
||||
logger.warn("Shutting down")
|
||||
logger.warning("Shutting down")
|
||||
break
|
||||
except Exception:
|
||||
# log the exception and continue
|
||||
|
|
@ -952,7 +952,7 @@ def main(options, session):
|
|||
try:
|
||||
time.sleep(options.sleeptime)
|
||||
except KeyboardInterrupt:
|
||||
logger.warn("User exit")
|
||||
logger.warning("User exit")
|
||||
break
|
||||
try:
|
||||
repomgr.checkQueue()
|
||||
|
|
|
|||
20
vm/kojivmd
20
vm/kojivmd
|
|
@ -67,7 +67,7 @@ except ImportError: # pragma: no cover
|
|||
def libvirt_callback(ignore, err):
|
||||
if err[3] != libvirt.VIR_ERR_ERROR:
|
||||
# Don't log libvirt errors: global error handler will do that
|
||||
logging.warn("Non-error from libvirt: '%s'", err[2])
|
||||
logging.warning("Non-error from libvirt: '%s'", err[2])
|
||||
|
||||
|
||||
libvirt.registerErrorHandler(f=libvirt_callback, ctx=None)
|
||||
|
|
@ -218,7 +218,7 @@ def main(options, session):
|
|||
raise SystemExit
|
||||
|
||||
def restart(*args):
|
||||
logger.warn("Initiating graceful restart")
|
||||
logger.warning("Initiating graceful restart")
|
||||
tm.restart_pending = True
|
||||
signal.signal(signal.SIGTERM, shutdown)
|
||||
signal.signal(signal.SIGUSR1, restart)
|
||||
|
|
@ -231,10 +231,10 @@ def main(options, session):
|
|||
taken = tm.getNextTask()
|
||||
tm.cleanupExpiredVMs()
|
||||
except (SystemExit, ServerExit, KeyboardInterrupt):
|
||||
logger.warn("Exiting")
|
||||
logger.warning("Exiting")
|
||||
break
|
||||
except ServerRestart:
|
||||
logger.warn("Restarting")
|
||||
logger.warning("Restarting")
|
||||
os.execv(sys.argv[0], sys.argv)
|
||||
except koji.AuthExpired:
|
||||
logger.error('Session expired')
|
||||
|
|
@ -252,9 +252,9 @@ def main(options, session):
|
|||
# from getting overloaded.
|
||||
time.sleep(options.sleeptime)
|
||||
except (SystemExit, KeyboardInterrupt):
|
||||
logger.warn("Exiting")
|
||||
logger.warning("Exiting")
|
||||
break
|
||||
logger.warn("Shutting down, please wait...")
|
||||
logger.warning("Shutting down, please wait...")
|
||||
tm.shutdown()
|
||||
session.logout()
|
||||
sys.exit(0)
|
||||
|
|
@ -884,7 +884,7 @@ class VMExecTask(BaseTaskHandler):
|
|||
time.sleep(15)
|
||||
info = vm.info()
|
||||
if info[0] in (libvirt.VIR_DOMAIN_CRASHED, libvirt.VIR_DOMAIN_SHUTOFF):
|
||||
self.logger.warn('VM %s crashed', clone_name)
|
||||
self.logger.warning('VM %s crashed', clone_name)
|
||||
self.server.server_close()
|
||||
raise koji.BuildError('VM %s crashed' % clone_name)
|
||||
if self.success is None:
|
||||
|
|
@ -984,7 +984,7 @@ class VMTaskManager(TaskManager):
|
|||
if availableMB < self.options.minspace:
|
||||
self.status = 'Insufficient disk space: %i MB, %i MB required' % \
|
||||
(availableMB, self.options.minspace)
|
||||
self.logger.warn(self.status)
|
||||
self.logger.warning(self.status)
|
||||
return False
|
||||
return True
|
||||
|
||||
|
|
@ -1005,7 +1005,7 @@ class VMTaskManager(TaskManager):
|
|||
if avail_mem < min_mem:
|
||||
self.status = 'Insufficient memory: %sk allocated, %sk available, %sk required' % \
|
||||
(vm_mem, avail_mem, min_mem)
|
||||
self.logger.warn(self.status)
|
||||
self.logger.warning(self.status)
|
||||
return False
|
||||
return True
|
||||
|
||||
|
|
@ -1044,7 +1044,7 @@ class VMTaskManager(TaskManager):
|
|||
vm = self.libvirt_conn.lookupByName(vm_name)
|
||||
except libvirt.libvirtError:
|
||||
# if we can't find the VM by name, it has probably been cleaned up manually
|
||||
self.logger.warn("Can't find %s, assuming it has already been cleaned up", vm_name)
|
||||
self.logger.warning("Can't find %s, assuming it has already been cleaned up", vm_name)
|
||||
return True
|
||||
info = vm.info()
|
||||
if info[0] not in (libvirt.VIR_DOMAIN_SHUTOFF, libvirt.VIR_DOMAIN_CRASHED):
|
||||
|
|
|
|||
|
|
@ -95,7 +95,7 @@ def _getUserCookie(environ):
|
|||
value = cookies['user'].value
|
||||
parts = value.split(":", 1)
|
||||
if len(parts) != 2:
|
||||
authlogger.warn('malformed user cookie: %s' % value)
|
||||
authlogger.warning('malformed user cookie: %s' % value)
|
||||
return None
|
||||
sig, value = parts
|
||||
if not options['Secret'].value:
|
||||
|
|
@ -105,18 +105,18 @@ def _getUserCookie(environ):
|
|||
digest_string = digest_string.encode('utf-8')
|
||||
shasum = hashlib.sha1(digest_string)
|
||||
if shasum.hexdigest() != sig:
|
||||
authlogger.warn('invalid user cookie: %s:%s', sig, value)
|
||||
authlogger.warning('invalid user cookie: %s:%s', sig, value)
|
||||
return None
|
||||
parts = value.split(":", 1)
|
||||
if len(parts) != 2:
|
||||
authlogger.warn('invalid signed user cookie: %s:%s', sig, value)
|
||||
authlogger.warning('invalid signed user cookie: %s:%s', sig, value)
|
||||
# no embedded timestamp
|
||||
return None
|
||||
user, timestamp = parts
|
||||
try:
|
||||
timestamp = float(timestamp)
|
||||
except ValueError:
|
||||
authlogger.warn('invalid time in signed user cookie: %s:%s', sig, value)
|
||||
authlogger.warning('invalid time in signed user cookie: %s:%s', sig, value)
|
||||
return None
|
||||
if (time.time() - timestamp) > (int(options['LoginTimeout']) * 60 * 60):
|
||||
authlogger.info('expired user cookie: %s', value)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue