()
| 138 | |
| 139 | |
| 140 | def get_disk_details(): |
| 141 | partitions = psutil.disk_partitions() |
| 142 | disk_info = {} |
| 143 | for partition in partitions: |
| 144 | try: |
| 145 | usage = psutil.disk_usage(partition.mountpoint) |
| 146 | disk_info[partition.device] = { |
| 147 | "Mountpoint": partition.mountpoint, |
| 148 | "Total": f"{usage.total / (1024**3):.2f} GB", |
| 149 | "Used": f"{usage.used / (1024**3):.2f} GB", |
| 150 | "Free": f"{usage.free / (1024**3):.2f} GB", |
| 151 | "Percentage": f"{usage.percent}%", |
| 152 | } |
| 153 | except OSError as inaccessible: |
| 154 | # Skip inaccessible partitions, such as removable drives with no media |
| 155 | logger.debug("Mountpoint %s inaccessible: %s", partition.mountpoint, inaccessible) |
| 156 | |
| 157 | return disk_info |
| 158 | |
| 159 | |
| 160 | def get_host_env(opt_out: bool = False): |
no outgoing calls
no test coverage detected
searching dependent graphs…