refactor: share connection and Debian host code for a second product (#52)
Proxmox Backup Server speaks the same REST dialect, logs in the same way and runs on Debian too, so what a second driver needs moves out of ProxmoxDriver first: - napalm_proxmox._base: the connection (proxmoxer service PVE or PBS, each with its port), the token split, the SSH session, run_command, the node helpers and the DMI read. - napalm_proxmox.host_mixin: packages and APT updates, the subscription, restart and shutdown through the API, root file writes and the transports of the host readers (kernel, listening sockets, identity, systemd, host status, apt's proxy). The PVE driver behaves as before; what it hands proxmoxer is pinned by tests first, and it now names service="PVE" explicitly. get_packages is split so the dpkg line parser stands alone; get_facts and get_packages leave the quality baseline.
This commit is contained in:
1 parent
a4c220d2e3
commit
0b5f82cc02
8 files changed
+786
-593
No files matched your search
@@ -194,17 +194,3 @@ class ProxmoxVMContractMixin:
|
||||
return parse_vm_config(str(vmid), vm_type, cfg)
|
||||
|
||||
# -- the node itself --------------------------------------------------------
|
||||
|
||||
def reboot_host(self) -> None:
|
||||
"""Restart this Proxmox node through the API (no SSH involved)."""
|
||||
try:
|
||||
self._node_api().status.post(command="reboot")
|
||||
except Exception as exc:
|
||||
raise RuntimeError(f"Reboot of node {self._node_name!r} refused: {exc}") from exc
|
||||
|
||||
def shutdown_host(self) -> None:
|
||||
"""Shut this Proxmox node down through the API; its guests stop as on any shutdown."""
|
||||
try:
|
||||
self._node_api().status.post(command="shutdown")
|
||||
except Exception as exc:
|
||||
raise RuntimeError(f"Shutdown of node {self._node_name!r} refused: {exc}") from exc
|
||||
Reference in new issue
Block a user