mirror of https://git.48k.eu/ogclient
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: dd999bfe34
("utils: rewrite ogReduceFs")
more_events
parent
88668cb195
commit
926a73cf33
|
@ -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}')
|
||||
|
|
Loading…
Reference in New Issue