[IMP] script todo: add "principal" choice to infra (one main VM per distro)
The infra distribution prompt now accepts "principal" (alongside numbers and "all"): it deploys the default version of each distro — ubuntu 24.04, debian 12, fedora 42 — one VM each. The default version is also marked with a * in the distro listing so it is visible. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
83f71561f8
commit
83a28ed9e8
2 changed files with 62 additions and 33 deletions
|
|
@ -1690,47 +1690,68 @@ class TODO:
|
||||||
return
|
return
|
||||||
distros = list(mod.DISTROS)
|
distros = list(mod.DISTROS)
|
||||||
|
|
||||||
# 1) Distributions (multi-sélection) ou catalogue complet.
|
# 1) Distributions : multi-sélection, catalogue complet, ou principal
|
||||||
|
# (la version par défaut de chaque distro, marquée d'un *).
|
||||||
print(f"\n{t('Distributions:')}")
|
print(f"\n{t('Distributions:')}")
|
||||||
for i, d in enumerate(distros, 1):
|
for i, d in enumerate(distros, 1):
|
||||||
vers = ", ".join(mod.DISTROS[d][0])
|
default_v = mod.DISTROS[d][1]
|
||||||
|
vers = ", ".join(
|
||||||
|
(v + " *" if v == default_v else v) for v in mod.DISTROS[d][0]
|
||||||
|
)
|
||||||
print(f" [{i}] {d} ({vers})")
|
print(f" [{i}] {d} ({vers})")
|
||||||
print(f" [all] {t('Whole catalog (every version)')}")
|
print(f" [all] {t('Whole catalog (every version)')}")
|
||||||
raw = input(t("Selection (numbers, or 'all', default: all): ")).strip()
|
print(
|
||||||
catalog_all = raw.lower() in ("", "all", "*")
|
f" [principal] {t('The main version of each distro (marked *)')}"
|
||||||
sel_distros = (
|
|
||||||
distros
|
|
||||||
if catalog_all
|
|
||||||
else self._parse_index_selection(raw.lower(), distros)
|
|
||||||
)
|
)
|
||||||
if not sel_distros:
|
raw = (
|
||||||
print(t("Nothing selected."))
|
input(
|
||||||
return
|
t("Selection (numbers, 'all' or 'principal', default: all): ")
|
||||||
|
)
|
||||||
|
.strip()
|
||||||
|
.lower()
|
||||||
|
)
|
||||||
|
catalog_all = raw in ("", "all", "*")
|
||||||
|
principal = raw in ("principal", "each", "p")
|
||||||
|
|
||||||
# 2) Versions par distro (multi-sélection) ; « all » si catalogue.
|
|
||||||
selected = [] # (distro, version, ram_mb, disk_str)
|
selected = [] # (distro, version, ram_mb, disk_str)
|
||||||
for d in sel_distros:
|
if principal:
|
||||||
versions_map = mod.DISTROS[d][0]
|
# Une VM par distro : sa version par défaut.
|
||||||
vlist = list(versions_map)
|
for d in distros:
|
||||||
if catalog_all:
|
versions_map, default_v = mod.DISTROS[d]
|
||||||
chosen = vlist
|
_c, _o, ram, disk = versions_map[default_v]
|
||||||
else:
|
selected.append((d, default_v, ram, disk))
|
||||||
print(f"\n{t('Versions for')} {d} :")
|
else:
|
||||||
for i, v in enumerate(vlist, 1):
|
sel_distros = (
|
||||||
|
distros
|
||||||
|
if catalog_all
|
||||||
|
else self._parse_index_selection(raw, distros)
|
||||||
|
)
|
||||||
|
if not sel_distros:
|
||||||
|
print(t("Nothing selected."))
|
||||||
|
return
|
||||||
|
# 2) Versions par distro (multi-sélection) ; « all » si catalogue.
|
||||||
|
for d in sel_distros:
|
||||||
|
versions_map = mod.DISTROS[d][0]
|
||||||
|
vlist = list(versions_map)
|
||||||
|
if catalog_all:
|
||||||
|
chosen = vlist
|
||||||
|
else:
|
||||||
|
print(f"\n{t('Versions for')} {d} :")
|
||||||
|
for i, v in enumerate(vlist, 1):
|
||||||
|
_c, _o, ram, disk = versions_map[v]
|
||||||
|
print(f" [{i}] {v} (RAM≥{ram}Mo, {disk})")
|
||||||
|
print(f" [all] {t('select all')}")
|
||||||
|
r = input(
|
||||||
|
t("Selection (numbers, or 'all', default: all): ")
|
||||||
|
).strip()
|
||||||
|
chosen = (
|
||||||
|
vlist
|
||||||
|
if r.lower() in ("", "all", "*")
|
||||||
|
else self._parse_index_selection(r.lower(), vlist)
|
||||||
|
)
|
||||||
|
for v in chosen:
|
||||||
_c, _o, ram, disk = versions_map[v]
|
_c, _o, ram, disk = versions_map[v]
|
||||||
print(f" [{i}] {v} (RAM≥{ram}Mo, {disk})")
|
selected.append((d, v, ram, disk))
|
||||||
print(f" [all] {t('select all')}")
|
|
||||||
r = input(
|
|
||||||
t("Selection (numbers, or 'all', default: all): ")
|
|
||||||
).strip()
|
|
||||||
chosen = (
|
|
||||||
vlist
|
|
||||||
if r.lower() in ("", "all", "*")
|
|
||||||
else self._parse_index_selection(r.lower(), vlist)
|
|
||||||
)
|
|
||||||
for v in chosen:
|
|
||||||
_c, _o, ram, disk = versions_map[v]
|
|
||||||
selected.append((d, v, ram, disk))
|
|
||||||
if not selected:
|
if not selected:
|
||||||
print(t("Nothing selected."))
|
print(t("Nothing selected."))
|
||||||
return
|
return
|
||||||
|
|
|
||||||
|
|
@ -1330,6 +1330,14 @@ TRANSLATIONS = {
|
||||||
"fr": "Tout le catalogue (chaque version)",
|
"fr": "Tout le catalogue (chaque version)",
|
||||||
"en": "Whole catalog (every version)",
|
"en": "Whole catalog (every version)",
|
||||||
},
|
},
|
||||||
|
"The main version of each distro (marked *)": {
|
||||||
|
"fr": "La version principale de chaque distro (marquée *)",
|
||||||
|
"en": "The main version of each distro (marked *)",
|
||||||
|
},
|
||||||
|
"Selection (numbers, 'all' or 'principal', default: all): ": {
|
||||||
|
"fr": "Sélection (numéros, « all » ou « principal », défaut : all) : ",
|
||||||
|
"en": "Selection (numbers, 'all' or 'principal', default: all): ",
|
||||||
|
},
|
||||||
"Selection (numbers, or 'all', default: all): ": {
|
"Selection (numbers, or 'all', default: all): ": {
|
||||||
"fr": "Sélection (numéros, ou « all », défaut : all) : ",
|
"fr": "Sélection (numéros, ou « all », défaut : all) : ",
|
||||||
"en": "Selection (numbers, or 'all', default: all): ",
|
"en": "Selection (numbers, or 'all', default: all): ",
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue