ADR-013 Phase 5: lean per-site builds (build-site.sh + guards + CI)

This commit is contained in:
2026-07-19 00:11:41 -04:00
parent de93b613cc
commit 99025d10f0
4 changed files with 183 additions and 5 deletions

View File

@@ -579,6 +579,8 @@ def seed_demo(force):
serialnumber=None, subtype_kwargs=None):
# create one Asset + its plugin subtype row, idempotent on assetnumber.
# returns the Asset, or None when the plugin type is not installed.
if subtype_model is None:
return None # plugin absent on a lean build - skip its demo rows
atype = AssetType.query.filter_by(assettype=assettype_name).first()
if not atype:
return None
@@ -602,11 +604,21 @@ def seed_demo(force):
made['assets'] += 1
return asset
from plugins.machines.models import Machine
from plugins.computers.models import Computer
from plugins.printers.models import Printer
from plugins.network.models import NetworkDevice
from plugins.measuringtools.models import MeasuringTool
# Guarded so demo seeding still works on a lean build that omits any of
# these plugins (ADR-013 Phase 5): a missing model just skips its section.
def _subtype_model(modulename, classname):
try:
module = __import__(f'plugins.{modulename}.models',
fromlist=[classname])
return getattr(module, classname)
except ImportError:
return None
Machine = _subtype_model('machines', 'Machine')
Computer = _subtype_model('computers', 'Computer')
Printer = _subtype_model('printers', 'Printer')
NetworkDevice = _subtype_model('network', 'NetworkDevice')
MeasuringTool = _subtype_model('measuringtools', 'MeasuringTool')
machines = [
('MILL-01', 'Haas VF-2 Mill', 'In Use', 'Cell A', 'Machining'),