Skip to content

Commit f3d14ee

Browse files
committed
Fix another case of missing subprocess output conversion from bytes to str
before use in comparison with native string. Follow-up to issue #288.
1 parent a942503 commit f3d14ee

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

mig/shared/resadm.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# --- BEGIN_HEADER ---
55
#
66
# resadm - Resource administration functions mostly for remote command execution
7-
# Copyright (C) 2003-2023 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
#
@@ -30,14 +30,15 @@
3030
from __future__ import absolute_import
3131

3232
from builtins import range
33+
import datetime
34+
import fcntl
3335
import os
3436
import tempfile
35-
import fcntl
3637
import time
37-
import datetime
3838

3939
# MiG imports
4040

41+
from mig.shared.base import force_native_str
4142
from mig.shared.conf import get_resource_configuration, get_resource_exe, \
4243
get_resource_store, get_configuration_object
4344
from mig.shared.fileio import unpickle, pickle
@@ -364,7 +365,7 @@ def fill_frontend_script(
364365
except Exception as err:
365366
msg = 'Error: could not write frontend script file'
366367
# NOTE: no logger available here
367-
#logger.error("%s: %s" % (msg, err))
368+
# logger.error("%s: %s" % (msg, err))
368369
return (False, msg)
369370

370371

@@ -470,7 +471,7 @@ def fill_exe_node_script(
470471
except Exception as err:
471472
msg = 'could not write exe node script file'
472473
# NOTE: no logger available here
473-
#logger.error("%s: %s" % (msg, err))
474+
# logger.error("%s: %s" % (msg, err))
474475
return (False, msg)
475476

476477

@@ -599,7 +600,8 @@ def check_mounted(target, logger):
599600
if os.path.ismount(target):
600601
return True
601602
mount_line = ' on %s type fuse.sshfs ' % target
602-
mount_out = subprocess_check_output(['mount'])
603+
# NOTE: we need output on str format for find below
604+
mount_out = force_native_str(subprocess_check_output(['mount']))
603605
logger.debug("check_mounted out: %s vs %s" % (mount_out, mount_line))
604606
return (mount_out.find(mount_line) != -1)
605607

0 commit comments

Comments
 (0)