diff options
author | OpenGnSys Support Team <soporte-og@soleta.eu> | 2024-05-09 11:44:43 +0200 |
---|---|---|
committer | OpenGnSys Support Team <soporte-og@soleta.eu> | 2024-05-09 11:47:06 +0200 |
commit | d109e99dbed453f2eb535e381ef807289f1040ac (patch) | |
tree | 5ab05ade7b0b479079c44f1dbaef061667e0f58b /src/utils/probe.py | |
parent | 6bfbf6cc7b8b5425eb8922769755a6c1cc2fb376 (diff) |
utils: rename cache_probe() to get_cache_dev_path()
This method reports the /dev path to cache partition, rename it.
Add explicit check if blkid is successful.
And add logging to report that device path to cache is not found.
Diffstat (limited to 'src/utils/probe.py')
-rw-r--r-- | src/utils/probe.py | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/utils/probe.py b/src/utils/probe.py index 8c0e39a..b2ed5de 100644 --- a/src/utils/probe.py +++ b/src/utils/probe.py @@ -135,14 +135,17 @@ def get_linux_distro_id(mountpoint): logging.error(f'os-release file not found at "{osrelease}"') return 'linux' -def cache_probe(): +def get_cache_dev_path(): """ - Runs 'blkid -L CACHE' and returns stripped stdout + Runs 'blkid -L CACHE' and returns stripped path to device, eg. /dev/sda3 """ proc_blkid = subprocess.run(['blkid', '-L', 'CACHE'], stdout=subprocess.PIPE) - stdout = proc_blkid.stdout.decode().strip() - return stdout + if proc_blkid.returncode != 0: + logging.error('Cannot find device path to cache') + return '' + + return proc_blkid.stdout.decode().strip() def get_os_family(mountpoint): |