lint/fs
This commit is contained in:
parent
e306971534
commit
63d30013a3
1 changed files with 8 additions and 3 deletions
|
@ -1,3 +1,5 @@
|
||||||
|
"""Operations involving FileSystems."""
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import shutil
|
import shutil
|
||||||
|
|
||||||
|
@ -6,7 +8,8 @@ from rwx import ps
|
||||||
CHARSET = "UTF-8"
|
CHARSET = "UTF-8"
|
||||||
|
|
||||||
|
|
||||||
def create_image(file_path: str, size_bytes: int):
|
def create_image(file_path: str, size_bytes: int) -> None:
|
||||||
|
"""Create a virtual device image file."""
|
||||||
ps.run(
|
ps.run(
|
||||||
("qemu-img", "create"),
|
("qemu-img", "create"),
|
||||||
("-f", "qcow2"),
|
("-f", "qcow2"),
|
||||||
|
@ -14,11 +17,13 @@ def create_image(file_path: str, size_bytes: int):
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def empty_file(path: str):
|
def empty_file(path: str) -> None:
|
||||||
|
"""Empty the file at provided path."""
|
||||||
write(path, "")
|
write(path, "")
|
||||||
|
|
||||||
|
|
||||||
def get_mount_uuid(path: str):
|
def get_mount_uuid(path: str) -> str:
|
||||||
|
"""Return the UUID of provided mountpoint path."""
|
||||||
return ps.run_line(
|
return ps.run_line(
|
||||||
("findmnt",),
|
("findmnt",),
|
||||||
("--noheadings",),
|
("--noheadings",),
|
||||||
|
|
Loading…
Reference in a new issue