4
4
# --- BEGIN_HEADER ---
5
5
#
6
6
# usagestats - Collect and report various central usage stats for the site
7
- # Copyright (C) 2020-2021 The MiG Project lead by Brian Vinter
7
+ # Copyright (C) 2003-2025 The MiG Project by the Science HPC Center at UCPH
8
8
#
9
9
# This file is part of MiG.
10
10
#
35
35
import sys
36
36
import time
37
37
38
- from mig .shared .base import extract_field
38
+ from mig .shared .base import extract_field , force_native_str
39
39
from mig .shared .defaults import freeze_meta_filename , keyword_auto
40
40
from mig .shared .fileio import unpickle , walk
41
41
from mig .shared .notification import send_email
@@ -297,7 +297,8 @@ def write_sitestats(configuration, stats, path_prefix, output_format):
297
297
env = cmd_env )
298
298
proc .wait ()
299
299
for line in proc .stdout .readlines ():
300
- site_stats ['disk' ]['use' ].append (line .strip ().split ())
300
+ # NOTE: output is system native encoding and we need native string
301
+ site_stats ['disk' ]['use' ].append (force_native_str (line .strip ()).split ())
301
302
if verbose :
302
303
print ("=== Disk Use ===" )
303
304
print ('\n ' .join (['\t ' .join (i ) for i in site_stats ['disk' ]['use' ]]))
@@ -308,7 +309,8 @@ def write_sitestats(configuration, stats, path_prefix, output_format):
308
309
proc = subprocess_popen (['mount' ] + mount_opts , stdout = subprocess_pipe )
309
310
proc .wait ()
310
311
for line in proc .stdout .readlines ():
311
- site_stats ['disk' ]['mounts' ].append (line .strip ().split ())
312
+ # NOTE: output is system native encoding and we need native string
313
+ site_stats ['disk' ]['mounts' ].append (force_native_str (line .strip ()).split ())
312
314
if verbose :
313
315
print ("=== Disk Mounts ===" )
314
316
print ('\n ' .join (['\t ' .join (i ) for i in site_stats ['disk' ]['mounts' ]]))
0 commit comments