summaryrefslogtreecommitdiffstats
path: root/src/utils/disk.py
diff options
context:
space:
mode:
authorJose M. Guisado <jguisado@soleta.eu>2022-04-18 10:59:35 +0200
committerJose M. Guisado <jguisado@soleta.eu>2022-04-21 09:47:04 +0200
commit902e0195055099c9ab59567407e5e5a90e80e7e7 (patch)
treee90fea613fcecffa694b3448311b0ee62f98af85 /src/utils/disk.py
parent79d3062f8166f17a0b8566184c4c3a8b0c9073c6 (diff)
Add utils modules
* disk.py Disk discovery * fs.py Uses psutil to fetch fs usage information * menu.py ogBrowser menu generation * net.py: gets nic status information IP address, MAC address and ethernet speed. * probe.py: probes mountpoints for operating systems Uses hivexget command to try fetching Windows installation information. Looks for /etc/os-release for probing linux systems.
Diffstat (limited to 'src/utils/disk.py')
-rw-r--r--src/utils/disk.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/utils/disk.py b/src/utils/disk.py
new file mode 100644
index 0000000..4f11a82
--- /dev/null
+++ b/src/utils/disk.py
@@ -0,0 +1,19 @@
+#
+# Copyright (C) 2022 Soleta Networks <info@soleta.eu>
+#
+# This program is free software: you can redistribute it and/or modify it under
+# the terms of the GNU Affero General Public License as published by the
+# Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+
+import os
+
+def get_disks():
+ """
+ Walks /sys/block/ and returns files starting with 'sd',
+ 'nvme' or 'vd'
+ """
+ return sorted([ dev for dev in os.listdir('/sys/block/')
+ if dev.startswith('sd')
+ or dev.startswith('nvme')
+ or dev.startswith('vd')])