Expand lab seed tiers, OpenAPI PARAMS, and console DATA/Params UX.
This commit is contained in:
+15
-9
@@ -12,17 +12,18 @@ from app.vsphere.domain.api_state import seed_api_surface
|
||||
from app.vsphere.domain.appliance import seed_appliance_state
|
||||
from app.vsphere.domain.content import seed_platform_extras
|
||||
from app.vsphere.domain.platform_surface import seed_platform_surface
|
||||
from app.vsphere.profiles import VsphereSeedProfile, build_vsphere_profile, props_json
|
||||
from app.vsphere.profiles import VsphereSeedProfile, build_vsphere_profile, infer_profile_hint, props_json
|
||||
from app.vsphere.security.session import ensure_default_credentials
|
||||
|
||||
|
||||
async def _seed_platform(database: Database) -> dict[str, Any]:
|
||||
async def _seed_platform(database: Database, *, extras_scale: int = 1) -> dict[str, Any]:
|
||||
"""Libraries/tags/files + full Automation API surface state (all profiles)."""
|
||||
|
||||
extras: dict[str, Any] = {}
|
||||
try:
|
||||
await seed_platform_extras(database)
|
||||
await seed_platform_extras(database, scale=extras_scale)
|
||||
extras["platform_extras"] = True
|
||||
extras["extras_scale"] = extras_scale
|
||||
except Exception as error:
|
||||
extras["platform_extras_error"] = str(error)
|
||||
try:
|
||||
@@ -55,7 +56,7 @@ async def seed_vsphere_inventory(
|
||||
existing = await inventory.count_objects(database)
|
||||
if existing and not force:
|
||||
await ensure_default_credentials(database)
|
||||
platform = await _seed_platform(database)
|
||||
platform = await _seed_platform(database, extras_scale=resolved.extras_scale)
|
||||
by_type = await inventory.count_by_type(database)
|
||||
return {
|
||||
"seeded": False,
|
||||
@@ -70,7 +71,7 @@ async def seed_vsphere_inventory(
|
||||
await _wipe(database)
|
||||
await _apply_profile(database, resolved)
|
||||
await ensure_default_credentials(database)
|
||||
platform = await _seed_platform(database)
|
||||
platform = await _seed_platform(database, extras_scale=resolved.extras_scale)
|
||||
by_type = await inventory.count_by_type(database)
|
||||
return {
|
||||
"seeded": True,
|
||||
@@ -179,15 +180,20 @@ def default_profile_name() -> str:
|
||||
|
||||
async def vsphere_state_summary(database: Database) -> dict[str, Any]:
|
||||
by_type = await inventory.count_by_type(database)
|
||||
hosts = by_type.get("HostSystem", 0)
|
||||
vms = by_type.get("VirtualMachine", 0)
|
||||
datastores = by_type.get("Datastore", 0)
|
||||
networks = by_type.get("Network", 0) + by_type.get("DistributedVirtualPortgroup", 0)
|
||||
return {
|
||||
"hosts": by_type.get("HostSystem", 0),
|
||||
"vms": by_type.get("VirtualMachine", 0),
|
||||
"datastores": by_type.get("Datastore", 0),
|
||||
"hosts": hosts,
|
||||
"vms": vms,
|
||||
"datastores": datastores,
|
||||
"networks": networks,
|
||||
"datacenters": by_type.get("Datacenter", 0),
|
||||
"clusters": by_type.get("ClusterComputeResource", 0),
|
||||
"objects": sum(by_type.values()),
|
||||
"by_type": by_type,
|
||||
"profile_hint": default_profile_name(),
|
||||
"profile_hint": infer_profile_hint(hosts=hosts, vms=vms, datastores=datastores),
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user