Skip to content

Commit e6c4f2c

Browse files
committed
Add a few variable initializations to address related pylint errors in PR #284.
None of them are all that important since we should already have prior checks in place e.g. in configuration init to bail out, but better safe than sorry.
1 parent 2169d8f commit e6c4f2c

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

mig/shared/accountstate.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# --- BEGIN_HEADER ---
55
#
66
# accountstate - various user account state helpers
7-
# Copyright (C) 2020-2024 The MiG Project lead by Brian Vinter
7+
# Copyright (C) 2003-2025 The MiG Project by the Science HPC Center at UCPH
88
#
99
# This file is part of MiG.
1010
#
@@ -452,6 +452,9 @@ def check_account_accessible(configuration, username, proto, environ=None,
452452
elif configuration.site_user_id_format == UUID_USER_ID_FORMAT:
453453
# Only follow first username -> client_id_dir symlink with UUID
454454
expanded_home = os.readlink(home_dir)
455+
else:
456+
raise ValueError("invalid user ID format requested: %s" %
457+
configuration.site_user_id_format)
455458
real_id = os.path.basename(expanded_home)
456459
client_id = client_dir_id(real_id)
457460

mig/shared/griddaemons/login.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# --- BEGIN_HEADER ---
55
#
66
# login - grid daemon login helper functions
7-
# Copyright (C) 2010-2024 The MiG Project lead by Brian Vinter
7+
# Copyright (C) 2003-2025 The MiG Project by the Science HPC Center at UCPH
88
#
99
# This file is part of MiG.
1010
#
@@ -551,7 +551,9 @@ def refresh_user_creds(configuration, protocol, username):
551551
# then build user_home from there as link may be just the name
552552
user_dir = os.path.basename(os.readlink(user_home))
553553
user_home = os.path.join(configuration.user_home, user_dir)
554-
554+
else:
555+
raise ValueError("invalid user ID format requested: %s" %
556+
configuration.site_user_id_format)
555557
# Check that user home exists
556558
if not os.path.exists(user_home):
557559
logger.warning("Skipping user without home %s" % user_home)
@@ -617,7 +619,7 @@ def refresh_job_creds(configuration, protocol, username):
617619
# logger.debug("No job creds changes for %s" % username)
618620
return (conf, changed_jobs)
619621

620-
job_dict = None
622+
job_dict, sessionid = None, None
621623
if os.path.islink(link_path) and os.path.exists(link_path) and \
622624
last_update < os.path.getmtime(link_path):
623625
sessionid = username
@@ -844,7 +846,7 @@ def refresh_jupyter_creds(configuration, protocol, username):
844846
# logger.debug("jupyter linkpath: %s jupyter path exists: %s" % \
845847
# (os.path.islink(link_path), os.path.exists(link_path)))
846848

847-
jupyter_dict = None
849+
jupyter_dict, sessionid = None, None
848850
if os.path.islink(link_path) and os.path.exists(link_path):
849851
sessionid = username
850852
jupyter_dict = unpickle(link_path, logger)

0 commit comments

Comments
 (0)