summaryrefslogtreecommitdiffstats
path: root/src/utils/fs.py
diff options
context:
space:
mode:
authorJose M. Guisado <jguisado@soleta.eu>2023-06-13 17:24:41 +0200
committerJose M. Guisado <jguisado@soleta.eu>2023-06-13 17:34:20 +0200
commit926a73cf33896ae62f8255a8f2aca2e0d9a54038 (patch)
tree3a4a43b924a03e98b415380905ebc67548b7ce28 /src/utils/fs.py
parent88668cb19534c9b7becf479370e8faee4c78ed39 (diff)
fs: fix subprocess input inside _extend_resize2fs
The subprocess module expects bytes-like object for "input" parameter by default. Passing a string object result in the following error: (2023-06-13 14:44:43) ogClient: [ERROR] - Exception when running "image create" subprocess (2023-06-13 14:44:43) ogClient: [ERROR] - Unexpected error Traceback (most recent call last): File "/opt/opengnsys/ogClient/src/live/ogOperations.py", line 465, in image_create ogExtendFs(disk, partition) File "/opt/opengnsys/ogClient/src/utils/fs.py", line 124, in ogExtendFs _extend_ntfsresize(partdev) File "/opt/opengnsys/ogClient/src/utils/fs.py", line 250, in _extend_ntfsresize proc = subprocess.run(cmd, input='y') File "/usr/lib/python3.8/subprocess.py", line 495, in run stdout, stderr = process.communicate(input, timeout=timeout) File "/usr/lib/python3.8/subprocess.py", line 1013, in communicate self._stdin_write(input) File "/usr/lib/python3.8/subprocess.py", line 962, in _stdin_write self.stdin.write(input) TypeError: a bytes-like object is required, not 'str' Fixes: dd999bfe34e7 ("utils: rewrite ogReduceFs")
Diffstat (limited to 'src/utils/fs.py')
-rw-r--r--src/utils/fs.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/utils/fs.py b/src/utils/fs.py
index 4d54586..57e6674 100644
--- a/src/utils/fs.py
+++ b/src/utils/fs.py
@@ -250,6 +250,6 @@ def _extend_resize2fs(partdev):
def _extend_ntfsresize(partdev):
cmd = shlex.split(f'ntfsresize -f {partdev}')
- proc = subprocess.run(cmd, input='y')
+ proc = subprocess.run(cmd, input=b'y')
if proc.returncode != 0:
raise RuntimeError(f'Error growing ntfs filesystem at {partdev}')