cleanix-cli 1.0.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- cleanix/__init__.py +4 -0
- cleanix/__main__.py +6 -0
- cleanix/cleaners/__init__.py +269 -0
- cleanix/cleaners/ai_cli.py +193 -0
- cleanix/cleaners/ai_tools.py +224 -0
- cleanix/cleaners/app_cruft.py +201 -0
- cleanix/cleaners/apple_litter.py +41 -0
- cleanix/cleaners/apps.py +89 -0
- cleanix/cleaners/apt.py +70 -0
- cleanix/cleaners/base.py +173 -0
- cleanix/cleaners/broken_symlinks.py +51 -0
- cleanix/cleaners/browsers.py +68 -0
- cleanix/cleaners/bsd.py +108 -0
- cleanix/cleaners/containers.py +82 -0
- cleanix/cleaners/coredumps.py +32 -0
- cleanix/cleaners/desktop_extras.py +42 -0
- cleanix/cleaners/dev_caches.py +57 -0
- cleanix/cleaners/distro_pkg.py +127 -0
- cleanix/cleaners/dnf.py +56 -0
- cleanix/cleaners/editor_litter.py +115 -0
- cleanix/cleaners/font_cache.py +29 -0
- cleanix/cleaners/ide.py +87 -0
- cleanix/cleaners/kernels.py +115 -0
- cleanix/cleaners/lang_caches.py +70 -0
- cleanix/cleaners/linux_extras.py +77 -0
- cleanix/cleaners/localizations.py +70 -0
- cleanix/cleaners/logs.py +80 -0
- cleanix/cleaners/macos.py +166 -0
- cleanix/cleaners/macos_extra.py +125 -0
- cleanix/cleaners/memory.py +110 -0
- cleanix/cleaners/more_pkg.py +168 -0
- cleanix/cleaners/npm_cache.py +36 -0
- cleanix/cleaners/packaging_extras.py +140 -0
- cleanix/cleaners/pacman.py +63 -0
- cleanix/cleaners/pip_cache.py +27 -0
- cleanix/cleaners/snapshots.py +126 -0
- cleanix/cleaners/sys_extras.py +109 -0
- cleanix/cleaners/temp_files.py +48 -0
- cleanix/cleaners/thumbnails.py +31 -0
- cleanix/cleaners/trash.py +47 -0
- cleanix/cleaners/user_cache.py +69 -0
- cleanix/cleaners/virtualization.py +76 -0
- cleanix/cli.py +810 -0
- cleanix/completion.py +131 -0
- cleanix/config.py +225 -0
- cleanix/core/__init__.py +1 -0
- cleanix/core/context.py +147 -0
- cleanix/core/engine.py +155 -0
- cleanix/core/history.py +55 -0
- cleanix/core/models.py +141 -0
- cleanix/core/platform.py +117 -0
- cleanix/core/quarantine.py +147 -0
- cleanix/core/registry.py +58 -0
- cleanix/core/report.py +130 -0
- cleanix/core/safety.py +166 -0
- cleanix/core/utils.py +244 -0
- cleanix/reset.py +328 -0
- cleanix/scheduler/__init__.py +1 -0
- cleanix/scheduler/systemd.py +160 -0
- cleanix_cli-1.0.1.dist-info/METADATA +436 -0
- cleanix_cli-1.0.1.dist-info/RECORD +64 -0
- cleanix_cli-1.0.1.dist-info/WHEEL +5 -0
- cleanix_cli-1.0.1.dist-info/entry_points.txt +2 -0
- cleanix_cli-1.0.1.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"""VM / container / cloud-CLI leftovers."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from pathlib import Path
|
|
6
|
+
from typing import Iterable, Tuple
|
|
7
|
+
|
|
8
|
+
from cleanix.cleaners.base import Cleaner, SCOPE_SYSTEM
|
|
9
|
+
from cleanix.core.models import CleanableItem
|
|
10
|
+
from cleanix.core.platform import LINUX
|
|
11
|
+
from cleanix.core.utils import home, iter_children, path_size
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
class VmToolingCleaner(Cleaner):
|
|
15
|
+
id = "vm_tooling"
|
|
16
|
+
name = "VM & cloud tooling caches"
|
|
17
|
+
description = "VirtualBox logs, Vagrant boxes, k8s & cloud-CLI caches"
|
|
18
|
+
requires_root = False
|
|
19
|
+
|
|
20
|
+
def find_items(self) -> Iterable[CleanableItem]:
|
|
21
|
+
h = home()
|
|
22
|
+
|
|
23
|
+
# VirtualBox per-VM logs.
|
|
24
|
+
vbox = h / "VirtualBox VMs"
|
|
25
|
+
if vbox.is_dir():
|
|
26
|
+
for vm in iter_children(vbox):
|
|
27
|
+
logs = vm / "Logs"
|
|
28
|
+
if logs.is_dir() and path_size(logs) > 0:
|
|
29
|
+
item = self.path_item(logs, f"VirtualBox logs: {vm.name}")
|
|
30
|
+
if item:
|
|
31
|
+
yield item
|
|
32
|
+
|
|
33
|
+
# Simple regenerable caches.
|
|
34
|
+
simple: Iterable[Tuple[Path, str]] = (
|
|
35
|
+
(h / ".vagrant.d" / "tmp", "Vagrant temp"),
|
|
36
|
+
(h / ".vagrant.d" / "boxes", "Vagrant downloaded boxes"),
|
|
37
|
+
(h / ".kube" / "cache", "kubectl cache"),
|
|
38
|
+
(h / ".kube" / "http-cache", "kubectl HTTP cache"),
|
|
39
|
+
(h / ".minikube" / "cache", "minikube cache"),
|
|
40
|
+
(h / ".cache" / "helm", "Helm cache"),
|
|
41
|
+
(h / ".aws" / "cli" / "cache", "AWS CLI cache"),
|
|
42
|
+
(h / ".azure" / "logs", "Azure CLI logs"),
|
|
43
|
+
(h / ".config" / "gcloud" / "logs", "gcloud logs"),
|
|
44
|
+
(h / ".terraform.d" / "plugin-cache", "Terraform plugin cache"),
|
|
45
|
+
(h / ".cache" / "pulumi", "Pulumi cache"),
|
|
46
|
+
)
|
|
47
|
+
seen = set()
|
|
48
|
+
for path, label in simple:
|
|
49
|
+
if path in seen or not path.exists() or path_size(path) <= 0:
|
|
50
|
+
continue
|
|
51
|
+
seen.add(path)
|
|
52
|
+
item = self.path_item(path, label)
|
|
53
|
+
if item:
|
|
54
|
+
yield item
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
class LibvirtSaveReporter(Cleaner):
|
|
58
|
+
id = "libvirt_saves"
|
|
59
|
+
name = "libvirt saved VM states"
|
|
60
|
+
description = "Suspended-VM memory images (report only — real state)"
|
|
61
|
+
requires_root = True
|
|
62
|
+
platforms = (LINUX,)
|
|
63
|
+
scope = SCOPE_SYSTEM
|
|
64
|
+
|
|
65
|
+
def find_items(self) -> Iterable[CleanableItem]:
|
|
66
|
+
save = Path("/var/lib/libvirt/qemu/save")
|
|
67
|
+
if not save.is_dir():
|
|
68
|
+
return
|
|
69
|
+
for child in iter_children(save):
|
|
70
|
+
item = self.report_item(
|
|
71
|
+
child,
|
|
72
|
+
f"libvirt saved state: {child.name}",
|
|
73
|
+
hint="restore/discard with: virsh restore / virsh managedsave-remove <vm>",
|
|
74
|
+
)
|
|
75
|
+
if item:
|
|
76
|
+
yield item
|