Add multi-distro support for deckies
Introduces DistroProfile catalog (9 distros: Debian, Ubuntu 20/22, Rocky 9, CentOS 7, Alpine, Fedora, Kali, Arch) with distro-styled hostname generation. Adds --distro and --randomize-distros CLI flags, a `decnet distros` listing command, and fixes composer.py which was ignoring per-decky base_image in favour of a hardcoded Debian constant. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -4,35 +4,26 @@ State is persisted to decnet-state.json in the working directory.
|
||||
"""
|
||||
|
||||
import json
|
||||
import random
|
||||
from pathlib import Path
|
||||
from typing import Literal
|
||||
|
||||
from pydantic import BaseModel, field_validator
|
||||
|
||||
from decnet.distros import random_hostname as _random_hostname
|
||||
|
||||
STATE_FILE = Path("decnet-state.json")
|
||||
|
||||
BASE_IMAGES = [
|
||||
"debian:bookworm-slim",
|
||||
"ubuntu:22.04",
|
||||
]
|
||||
|
||||
DECKY_NAME_WORDS = [
|
||||
"alpha", "bravo", "charlie", "delta", "echo",
|
||||
"foxtrot", "golf", "hotel", "india", "juliet",
|
||||
"kilo", "lima", "mike", "nova", "oscar",
|
||||
]
|
||||
|
||||
|
||||
def random_hostname() -> str:
|
||||
return f"SRV-{random.choice(DECKY_NAME_WORDS).upper()}-{random.randint(10, 99)}"
|
||||
def random_hostname(distro_slug: str = "debian") -> str:
|
||||
return _random_hostname(distro_slug)
|
||||
|
||||
|
||||
class DeckyConfig(BaseModel):
|
||||
name: str
|
||||
ip: str
|
||||
services: list[str]
|
||||
base_image: str
|
||||
distro: str # slug from distros.DISTROS, e.g. "debian", "ubuntu22"
|
||||
base_image: str # resolved Docker image tag
|
||||
hostname: str
|
||||
|
||||
@field_validator("services")
|
||||
|
||||
Reference in New Issue
Block a user