Skip to content

Commit 69a3306

Browse files
MakFlyclaude
andcommitted
feat(node): bascule les dépôts APT sans abonnement et dit s'il faut mettre le nœud à jour
« node repo ls|no-subscription » lit et corrige les dépôts par l'API (/nodes/{node}/apt/repositories) : no-subscription est ajouté avant que les dépôts enterprise.proxmox.com soient désactivés, pour que le nœud ne reste jamais sans dépôt Proxmox. Ceph garde sa série. Le plan imprime la commande pvesh qui défait chaque désactivation, et la relecture prouve le résultat. « node updates » répond à « dois-je mettre à jour ? » : paquets en attente, pve-manager installé et candidat, nouveau noyau, redémarrage requis, démons sur une version antérieure, montées de version majeure. /apt/update exige Sys.Modify ; sans lui la commande se replie sur /apt/versions (Sys.Audit) et se dit partielle. --sync lance apt update, --exit-code rend 10 ou 11, --notify/--refresh alimentent le hook shell avec un cache de 6 h. Vérifié sur le nœud du lab (PVE 9.2.6 puis 9.2.21) : bascule réelle depuis un état enterprise, --sync suivi jusqu'au bout, verdict « redémarrage requis » après full-upgrade. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 6952412 commit 69a3306

17 files changed

Lines changed: 4689 additions & 11 deletions

‎README.md‎

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,11 @@ answer the prompt instantly and be allowed to wait on the network:
236236
the one allowed to reach GitHub (2s timeout), and it never prints anything,
237237
success or failure — it only updates the cache for the *next* terminal.
238238

239+
The same snippet runs `pvecli node updates --notify` / `--refresh` for the
240+
default node, with a 6h cache keyed by context and node: one line when the node
241+
has pending updates or waits for a reboot, nothing otherwise. Re-run
242+
`pvecli update install-hook` once to pick it up on a poste wired before.
243+
239244
The trade-off is deliberate: the notification is always one terminal behind
240245
the truth. See `cmd/assets/update-notify.sh` for why the backgrounding
241246
itself is written the way it is (avoiding zsh's own job-control noise).
@@ -728,6 +733,46 @@ Worth stating plainly: this circumvents a licence check. On a homelab it is
728733
inconsequential. In production the Community subscription is the clean path, and
729734
it is what opens the better-tested `pve-enterprise` repository.
730735

736+
**APT repositories**, over the API this time (no SSH). A fresh install ships with
737+
`pve-enterprise` enabled; without a key `apt update` fails on it with a 401, and
738+
the node silently stops receiving Proxmox updates. Proxmox VE is free software
739+
(AGPLv3) and complete without a subscription: `no-subscription` is the public
740+
repository Proxmox publishes for exactly that use.
741+
742+
```sh
743+
pvecli node repo ls # every stanza, then: is an enterprise repo still enabled?
744+
pvecli node repo no-subscription --dry-run # the writes, and the exact pvesh command that undoes each
745+
pvecli node repo no-subscription # add no-subscription first, then disable enterprise
746+
```
747+
748+
Additions come before disabling, so the node is never left without a Proxmox
749+
repository. Ceph follows the same rule **within its release**:
750+
`ceph-squid-enterprise` becomes `ceph-squid-no-subscription`, never Tentacle,
751+
because changing Ceph series is a major upgrade, not a repository change.
752+
Disabled stanzas stay in their files (`Enabled: false`). Privilege:
753+
`Sys.Modify` on `/nodes/{node}`; reading takes `Sys.Audit`.
754+
755+
**Should I upgrade the node?**
756+
757+
```sh
758+
pvecli node updates # verdict, pve-manager installed → candidate, kernel, top packages
759+
pvecli node updates --all # every pending package
760+
pvecli node updates --sync # run `apt update` on the node first, and follow the task
761+
pvecli node updates --exit-code # 0 up to date, 10 updates pending, 11 reboot required
762+
```
763+
764+
The answer comes from the node's own package index, which PVE refreshes daily
765+
(`pve-daily-update.timer`); `--sync` refreshes it now. Besides the pending
766+
packages it reports whether the upgrade brings a new kernel, whether a kernel
767+
newer than the running one is **already** installed (reboot pending, upgrade or
768+
not), whether `pveproxy`/`pvedaemon` still run an older `pve-manager`, and any
769+
package that changes **major** version, which usually means a repository points
770+
at the next series. Listing the full set of pending updates takes `Sys.Modify`
771+
(`GET /apt/update`); without it the command falls back to the Proxmox packages
772+
of `/apt/versions` (`Sys.Audit`) and says the answer is partial. It never
773+
installs anything: on the node, `apt update && apt full-upgrade`, never
774+
`apt upgrade`.
775+
731776
## Configuration
732777

733778
Layered, in decreasing priority: **flags → environment → config file →

‎cmd/assets/proxmox-ops.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,8 @@ création avec un message qui ne dit pas toujours pourquoi.
125125
| service demandé mais jamais installé | le tag `svc_<id>` absent de la déclaration | rejouer `vm declare --with …`, puis `iac apply` **avant** `iac configure` |
126126
| tunnel actif, tout répond 404 | un catch-all ailleurs qu'en dernier dans la table d'ingress | `pvecli cf route ls --tunnel <nom>` ; pvecli le remet en fin, un `config.yml` édité à la main non |
127127
| le nom public expire au lieu d'échouer | CNAME vers `cfargotunnel.com` **non proxifié** | il n'est joignable qu'à travers Cloudflare ; `proxied` doit rester vrai |
128+
| `apt update` échoue en 401, plus aucune mise à jour Proxmox | dépôt `pve-enterprise` actif sans abonnement | `pvecli node repo ls`, puis `pvecli node repo no-subscription` |
129+
| « faut-il mettre le nœud à jour ? » | | `pvecli node updates` (`--sync` pour rafraîchir l'index d'abord). L'installation se fait sur le nœud : `apt full-upgrade`, jamais par l'API |
128130
| `iac configure --cf-tunnel` : jeton introuvable | le tunnel n'a pas été créé par `pvecli cf tunnel create` | c'est cette commande qui range le jeton au trousseau |
129131

130132
---

‎cmd/assets/update-notify.sh‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,3 +74,12 @@ pvecli update check --notify 2>/dev/null
7474
# ceinture : `--refresh` ne dit déjà rien, en succès comme en échec, mais ça
7575
# garde un futur panic Go loin du prompt aussi.
7676
( pvecli update check --refresh >/dev/null 2>&1 & ) 2>/dev/null
77+
78+
# Même contrat, pour le NŒUD cette fois : « pvecli node updates » dit si le
79+
# Proxmox du nœud par défaut a des mises à jour en attente ou attend un
80+
# redémarrage. --notify lit le cache (une ligne ou rien), --refresh interroge
81+
# l'API en arrière-plan quand le cache a plus de 6 h. Sans nœud par défaut ou
82+
# sans secret, les deux se taisent : un poste qui ne pilote aucun nœud ne doit
83+
# rien voir de plus qu'avant.
84+
pvecli node updates --notify 2>/dev/null
85+
( pvecli node updates --refresh >/dev/null 2>&1 & ) 2>/dev/null

‎cmd/node.go‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ du nœud n'est pas un détail d'affichage, c'est une donnée structurante que
2626
toutes les autres commandes exigeront.`,
2727
Args: usage(cobra.NoArgs),
2828
}
29-
c.AddCommand(newNodeListCmd(), newNodeShowCmd(), newNodeRebootCmd(), newNodeNagCmd())
29+
c.AddCommand(newNodeListCmd(), newNodeShowCmd(), newNodeRebootCmd(), newNodeNagCmd(),
30+
newNodeRepoCmd(), newNodeUpdatesCmd())
3031
return c
3132
}
3233

0 commit comments

Comments
 (0)