loft-cli 0.11.0__tar.gz → 1.0.1__tar.gz
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.
- {loft_cli-0.11.0 → loft_cli-1.0.1}/PKG-INFO +1 -1
- {loft_cli-0.11.0 → loft_cli-1.0.1}/loft_cli/agent_installer.py +21 -0
- {loft_cli-0.11.0 → loft_cli-1.0.1}/loft_cli/cli.py +17 -0
- loft_cli-1.0.1/loft_cli/runtime/steps/docker.py +18 -0
- {loft_cli-0.11.0 → loft_cli-1.0.1}/loft_cli.egg-info/PKG-INFO +1 -1
- {loft_cli-0.11.0 → loft_cli-1.0.1}/pyproject.toml +1 -1
- loft_cli-0.11.0/loft_cli/runtime/steps/docker.py +0 -15
- {loft_cli-0.11.0 → loft_cli-1.0.1}/README.md +0 -0
- {loft_cli-0.11.0 → loft_cli-1.0.1}/loft_cli/__init__.py +0 -0
- {loft_cli-0.11.0 → loft_cli-1.0.1}/loft_cli/_builtins.py +0 -0
- {loft_cli-0.11.0 → loft_cli-1.0.1}/loft_cli/addons/__init__.py +0 -0
- {loft_cli-0.11.0 → loft_cli-1.0.1}/loft_cli/addons/goss/__init__.py +0 -0
- {loft_cli-0.11.0 → loft_cli-1.0.1}/loft_cli/addons/goss/generator.py +0 -0
- {loft_cli-0.11.0 → loft_cli-1.0.1}/loft_cli/addons/goss/renderer.py +0 -0
- {loft_cli-0.11.0 → loft_cli-1.0.1}/loft_cli/addons/goss/shipper.py +0 -0
- {loft_cli-0.11.0 → loft_cli-1.0.1}/loft_cli/checks/__init__.py +0 -0
- {loft_cli-0.11.0 → loft_cli-1.0.1}/loft_cli/checks/compose.py +0 -0
- {loft_cli-0.11.0 → loft_cli-1.0.1}/loft_cli/checks/container.py +0 -0
- {loft_cli-0.11.0 → loft_cli-1.0.1}/loft_cli/checks/http.py +0 -0
- {loft_cli-0.11.0 → loft_cli-1.0.1}/loft_cli/checks/nginx.py +0 -0
- {loft_cli-0.11.0 → loft_cli-1.0.1}/loft_cli/checks/ports.py +0 -0
- {loft_cli-0.11.0 → loft_cli-1.0.1}/loft_cli/checks/postgres.py +0 -0
- {loft_cli-0.11.0 → loft_cli-1.0.1}/loft_cli/checks/ssh.py +0 -0
- {loft_cli-0.11.0 → loft_cli-1.0.1}/loft_cli/checks/wireguard.py +0 -0
- {loft_cli-0.11.0 → loft_cli-1.0.1}/loft_cli/commands/prep.py +0 -0
- {loft_cli-0.11.0 → loft_cli-1.0.1}/loft_cli/compiler/__init__.py +0 -0
- {loft_cli-0.11.0 → loft_cli-1.0.1}/loft_cli/compiler/normalizer.py +0 -0
- {loft_cli-0.11.0 → loft_cli-1.0.1}/loft_cli/compiler/parser.py +0 -0
- {loft_cli-0.11.0 → loft_cli-1.0.1}/loft_cli/compiler/planner.py +0 -0
- {loft_cli-0.11.0 → loft_cli-1.0.1}/loft_cli/local/__init__.py +0 -0
- {loft_cli-0.11.0 → loft_cli-1.0.1}/loft_cli/local/ddl/__init__.py +0 -0
- {loft_cli-0.11.0 → loft_cli-1.0.1}/loft_cli/local/ddl/bootstrap_tables.py +0 -0
- {loft_cli-0.11.0 → loft_cli-1.0.1}/loft_cli/local/ddl/versionize_system.py +0 -0
- {loft_cli-0.11.0 → loft_cli-1.0.1}/loft_cli/local/fleet.py +0 -0
- {loft_cli-0.11.0 → loft_cli-1.0.1}/loft_cli/local/inventory.py +0 -0
- {loft_cli-0.11.0 → loft_cli-1.0.1}/loft_cli/local/inventory_db.py +0 -0
- {loft_cli-0.11.0 → loft_cli-1.0.1}/loft_cli/local/keys.py +0 -0
- {loft_cli-0.11.0 → loft_cli-1.0.1}/loft_cli/local/remove.py +0 -0
- {loft_cli-0.11.0 → loft_cli-1.0.1}/loft_cli/local/selector.py +0 -0
- {loft_cli-0.11.0 → loft_cli-1.0.1}/loft_cli/local/ssh_config.py +0 -0
- {loft_cli-0.11.0 → loft_cli-1.0.1}/loft_cli/local/tunnel.py +0 -0
- {loft_cli-0.11.0 → loft_cli-1.0.1}/loft_cli/local/wireguard_store.py +0 -0
- {loft_cli-0.11.0 → loft_cli-1.0.1}/loft_cli/logs/__init__.py +0 -0
- {loft_cli-0.11.0 → loft_cli-1.0.1}/loft_cli/logs/reader.py +0 -0
- {loft_cli-0.11.0 → loft_cli-1.0.1}/loft_cli/logs/writer.py +0 -0
- {loft_cli-0.11.0 → loft_cli-1.0.1}/loft_cli/runtime/__init__.py +0 -0
- {loft_cli-0.11.0 → loft_cli-1.0.1}/loft_cli/runtime/agent_transport.py +0 -0
- {loft_cli-0.11.0 → loft_cli-1.0.1}/loft_cli/runtime/executor.py +0 -0
- {loft_cli-0.11.0 → loft_cli-1.0.1}/loft_cli/runtime/fabric_transport.py +0 -0
- {loft_cli-0.11.0 → loft_cli-1.0.1}/loft_cli/runtime/secret_rotation.py +0 -0
- {loft_cli-0.11.0 → loft_cli-1.0.1}/loft_cli/runtime/ssh.py +0 -0
- {loft_cli-0.11.0 → loft_cli-1.0.1}/loft_cli/runtime/steps/__init__.py +0 -0
- {loft_cli-0.11.0 → loft_cli-1.0.1}/loft_cli/runtime/steps/backup.py +0 -0
- {loft_cli-0.11.0 → loft_cli-1.0.1}/loft_cli/runtime/steps/bootstrap.py +0 -0
- {loft_cli-0.11.0 → loft_cli-1.0.1}/loft_cli/runtime/steps/compose.py +0 -0
- {loft_cli-0.11.0 → loft_cli-1.0.1}/loft_cli/runtime/steps/container.py +0 -0
- {loft_cli-0.11.0 → loft_cli-1.0.1}/loft_cli/runtime/steps/file_template.py +0 -0
- {loft_cli-0.11.0 → loft_cli-1.0.1}/loft_cli/runtime/steps/nginx.py +0 -0
- {loft_cli-0.11.0 → loft_cli-1.0.1}/loft_cli/runtime/steps/postgres.py +0 -0
- {loft_cli-0.11.0 → loft_cli-1.0.1}/loft_cli/runtime/steps/postgres_ensure.py +0 -0
- {loft_cli-0.11.0 → loft_cli-1.0.1}/loft_cli/runtime/steps/systemd.py +0 -0
- {loft_cli-0.11.0 → loft_cli-1.0.1}/loft_cli/runtime/steps/wireguard.py +0 -0
- {loft_cli-0.11.0 → loft_cli-1.0.1}/loft_cli/runtime/transport.py +0 -0
- {loft_cli-0.11.0 → loft_cli-1.0.1}/loft_cli/updater.py +0 -0
- {loft_cli-0.11.0 → loft_cli-1.0.1}/loft_cli.egg-info/SOURCES.txt +0 -0
- {loft_cli-0.11.0 → loft_cli-1.0.1}/loft_cli.egg-info/dependency_links.txt +0 -0
- {loft_cli-0.11.0 → loft_cli-1.0.1}/loft_cli.egg-info/entry_points.txt +0 -0
- {loft_cli-0.11.0 → loft_cli-1.0.1}/loft_cli.egg-info/requires.txt +0 -0
- {loft_cli-0.11.0 → loft_cli-1.0.1}/loft_cli.egg-info/top_level.txt +0 -0
- {loft_cli-0.11.0 → loft_cli-1.0.1}/setup.cfg +0 -0
|
@@ -34,6 +34,27 @@ def detect_agent(transport: Transport) -> str | None:
|
|
|
34
34
|
return None
|
|
35
35
|
|
|
36
36
|
|
|
37
|
+
def check_version_compatibility(client_version: str, agent_version: str) -> tuple[bool, str]:
|
|
38
|
+
"""Check that client and agent major versions match.
|
|
39
|
+
|
|
40
|
+
Returns (compatible: bool, message: str). A mismatch is an error from v1.0
|
|
41
|
+
onwards — major versions must match for the plan format and API to be stable.
|
|
42
|
+
"""
|
|
43
|
+
try:
|
|
44
|
+
client_major = int(client_version.split(".")[0])
|
|
45
|
+
agent_major = int(agent_version.split(".")[0])
|
|
46
|
+
except (ValueError, IndexError):
|
|
47
|
+
return True, "" # Cannot parse — allow and let the apply fail naturally
|
|
48
|
+
|
|
49
|
+
if client_major != agent_major:
|
|
50
|
+
return False, (
|
|
51
|
+
f"Client v{client_version} requires agent v{client_major}.x, "
|
|
52
|
+
f"but agent v{agent_version} is installed. "
|
|
53
|
+
f"Run: loft-cli agent-update <host>"
|
|
54
|
+
)
|
|
55
|
+
return True, ""
|
|
56
|
+
|
|
57
|
+
|
|
37
58
|
def install_agent_commands() -> list[str]:
|
|
38
59
|
"""Return the shell commands to create agent directories on the target.
|
|
39
60
|
|
|
@@ -544,6 +544,15 @@ def doctor(
|
|
|
544
544
|
transport.close()
|
|
545
545
|
raise typer.Exit(1)
|
|
546
546
|
|
|
547
|
+
from loft_cli import __version__
|
|
548
|
+
from loft_cli.agent_installer import check_version_compatibility
|
|
549
|
+
|
|
550
|
+
compatible, compat_msg = check_version_compatibility(__version__, agent_version)
|
|
551
|
+
if not compatible:
|
|
552
|
+
console.print(f"[bold red]Version mismatch:[/bold red] {compat_msg}")
|
|
553
|
+
transport.close()
|
|
554
|
+
raise typer.Exit(1)
|
|
555
|
+
|
|
547
556
|
# Upload the current plan as the desired state
|
|
548
557
|
from loft_cli_core.agent_paths import AGENT_BINARY_PATH, AGENT_DESIRED_DIR
|
|
549
558
|
|
|
@@ -1058,6 +1067,14 @@ def _apply_single(parsed_spec, ctx, p, mode, dry_run, console) -> None:
|
|
|
1058
1067
|
|
|
1059
1068
|
agent_version = detect_agent(transport)
|
|
1060
1069
|
if agent_version:
|
|
1070
|
+
from loft_cli import __version__
|
|
1071
|
+
from loft_cli.agent_installer import check_version_compatibility
|
|
1072
|
+
|
|
1073
|
+
compatible, compat_msg = check_version_compatibility(__version__, agent_version)
|
|
1074
|
+
if not compatible:
|
|
1075
|
+
console.print(f"[bold red]Version mismatch:[/bold red] {compat_msg}")
|
|
1076
|
+
transport.close()
|
|
1077
|
+
raise typer.Exit(1)
|
|
1061
1078
|
console.print(
|
|
1062
1079
|
f"[dim]Agent detected (v{agent_version}) — using agent execution[/dim]"
|
|
1063
1080
|
)
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"""Docker installation commands."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
def install_docker() -> str:
|
|
7
|
+
"""Install Docker only when it is missing. The installer script also upgrades an existing installation, and that
|
|
8
|
+
restarts docker.service: every container on the host stops, a loft-cli applying from one of them included.
|
|
9
|
+
"""
|
|
10
|
+
return "bash -c 'command -v docker >/dev/null 2>&1 || curl -fsSL https://get.docker.com | sh'"
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def enable_docker() -> str:
|
|
14
|
+
return "systemctl enable --now docker"
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def docker_version_check() -> str:
|
|
18
|
+
return "docker --version"
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "loft-cli"
|
|
7
|
-
version = "0.
|
|
7
|
+
version = "1.0.1"
|
|
8
8
|
description = "Securely bootstrap Linux servers with auditable plans, generated ops docs, and encrypted local inventory"
|
|
9
9
|
requires-python = ">=3.11"
|
|
10
10
|
dependencies = [
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"""Docker installation commands."""
|
|
2
|
-
|
|
3
|
-
from __future__ import annotations
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
def install_docker() -> str:
|
|
7
|
-
return "bash -c 'curl -fsSL https://get.docker.com | sh'"
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
def enable_docker() -> str:
|
|
11
|
-
return "systemctl enable --now docker"
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
def docker_version_check() -> str:
|
|
15
|
-
return "docker --version"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|