Initial commit: VMware vSphere API simulator scaffold.
Add the FastAPI app, PostgreSQL migrations, Docker/Helm packaging, API contracts, docs, client examples, and the unit/integration/compatibility test suite for local client and tooling labs without a real vCenter.
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
"""Apply a deterministic simulation seed."""
|
||||
|
||||
import asyncio
|
||||
import json
|
||||
import os
|
||||
|
||||
from app.config import get_settings
|
||||
from app.db.pool import AsyncpgDatabase
|
||||
from app.vsphere.seed import seed_vsphere_inventory
|
||||
|
||||
|
||||
async def run() -> None:
|
||||
settings = get_settings()
|
||||
enable_pve = os.getenv("ENABLE_PVE_STUB", "false").lower() in {"1", "true", "yes"}
|
||||
proxmox_stub: dict | None = None
|
||||
if enable_pve:
|
||||
from app.simulation.seed import seed_url
|
||||
|
||||
proxmox_stub = await seed_url(
|
||||
settings.database_url.get_secret_value(),
|
||||
os.getenv("SEED_PROFILE", "small"),
|
||||
large_nodes=int(os.getenv("SEED_LARGE_NODES", "10")),
|
||||
large_resources=int(os.getenv("SEED_LARGE_RESOURCES", "10000")),
|
||||
)
|
||||
database = AsyncpgDatabase(settings)
|
||||
await database.connect()
|
||||
try:
|
||||
vsphere = await seed_vsphere_inventory(
|
||||
database,
|
||||
force=True,
|
||||
profile=os.getenv("SEED_VSPHERE_PROFILE", "large"),
|
||||
large_hosts=int(os.getenv("SEED_VSPHERE_LARGE_HOSTS", "10")),
|
||||
large_vms=int(os.getenv("SEED_VSPHERE_LARGE_VMS", "1000")),
|
||||
)
|
||||
finally:
|
||||
await database.close()
|
||||
payload = {"vsphere": vsphere}
|
||||
if proxmox_stub is not None:
|
||||
payload["proxmox_stub"] = proxmox_stub
|
||||
print(json.dumps(payload, sort_keys=True))
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
asyncio.run(run())
|
||||
Reference in New Issue
Block a user