utils: is_path_on_nfs: strip not existing path
PATCH 1/1 utils: is_path_on_nfs: strip not existing path
From: Jose Quaresma <[email protected]>
When the user provide a path that does not exist it fails with:
| stat: cannot read file system information for '/path/to/my/hashserve': No such file or directory
We can strip the non exising part in the path and pass just that to the stat.
Signed-off-by Jose Quaresma <[email protected]>
--- lib/bb/utils.py | 5 +++++ 1 file changed, 5 insertions(+)
lib/bb/utils.py +5 -0
@@ -2269,6 +2269,11 @@ def is_path_on_nfs(path): """ Returns True if ``path`` argument is on a NFS mount. """ + # strip not existing path + if os.path.isabs(path): + while not os.path.exists(path): + path = os.path.dirname(path) + import bb.process fstype = bb.process.run("stat -f -c %T {}".format(path))[0].strip() return fstype == "nfs"
Signature · 1 line
2.53.0