Skip to content

Commit 46b107a

Browse files
ocaisaboegel
andauthored
Maybe even os.geteuid() fails
Co-authored-by: Kenneth Hoste <kenneth.hoste@ugent.be>
1 parent baf37da commit 46b107a

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

easybuild/tools/options.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -244,12 +244,14 @@ def __init__(self, *args, **kwargs):
244244
self.default_robot_paths = get_paths_for(subdir=EASYCONFIGS_PKG_SUBDIR, robot_path=None) or []
245245

246246
# set up constants to seed into config files parser, by section
247-
user = "unknown_userid"
248247
try:
249248
user = pwd.getpwuid(os.geteuid()).pw_name
250249
except KeyError:
251-
# On some systems you may not have NSS on compute nodes, but the envvars will be available
252-
user = os.getenv("USER") or os.getenv("LOGNAME") or str(os.geteuid())
250+
# On some systems you may not have NSS on compute nodes, but the env vars should be available
251+
try:
252+
user = os.getenv("USER") or os.getenv("LOGNAME") or str(os.geteuid())
253+
except:
254+
user = "unknown_userid"
253255
self.go_cfg_constants = {
254256
self.DEFAULTSECT: {
255257
'DEFAULT_REPOSITORYPATH': (self.default_repositorypath[0],

0 commit comments

Comments
 (0)