|
35 | 35 | import sys
|
36 | 36 | import time
|
37 | 37 |
|
38 |
| -from mig.shared.base import extract_field, force_native_str |
| 38 | +from mig.shared.base import extract_field |
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
|
@@ -293,24 +293,25 @@ def write_sitestats(configuration, stats, path_prefix, output_format):
|
293 | 293 | # NOTE: df expects multiple file system types as individual options
|
294 | 294 | for fs_type in only_fs_types:
|
295 | 295 | df_opts += ['-t', fs_type]
|
| 296 | + # NOTE: we want utf8-encoded output as text str for concat below |
296 | 297 | proc = subprocess_popen(['/bin/df'] + df_opts, stdout=subprocess_pipe,
|
297 |
| - env=cmd_env) |
| 298 | + text=True, env=cmd_env) |
298 | 299 | proc.wait()
|
299 | 300 | for line in proc.stdout.readlines():
|
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 | + site_stats['disk']['use'].append(line.strip().split()) |
302 | 302 | if verbose:
|
303 | 303 | print("=== Disk Use ===")
|
304 | 304 | print('\n'.join(['\t'.join(i) for i in site_stats['disk']['use']]))
|
305 | 305 |
|
306 | 306 | # NOTE: mount expects multiple file system types as single comma-sep arg
|
307 | 307 | mount_opts = []
|
308 | 308 | mount_opts += ['-t', ','.join(only_fs_types)]
|
309 |
| - proc = subprocess_popen(['mount'] + mount_opts, stdout=subprocess_pipe) |
| 309 | + # NOTE: we want utf8-encoded output as text str for concat below |
| 310 | + proc = subprocess_popen(['mount'] + mount_opts, stdout=subprocess_pipe, |
| 311 | + text=True) |
310 | 312 | proc.wait()
|
311 | 313 | for line in proc.stdout.readlines():
|
312 |
| - # NOTE: output is system native encoding and we need native string |
313 |
| - site_stats['disk']['mounts'].append(force_native_str(line.strip()).split()) |
| 314 | + site_stats['disk']['mounts'].append(line.strip().split()) |
314 | 315 | if verbose:
|
315 | 316 | print("=== Disk Mounts ===")
|
316 | 317 | print('\n'.join(['\t'.join(i) for i in site_stats['disk']['mounts']]))
|
|
0 commit comments