Bundle Yamale schema

TIL! Using the existence of obscure member sys._MEIPASS, I can detect if
we're running from a bundled PyInstaller binary, versus running from Python
directly.

Add schema.yaml to the datas of the PyInstaller spec. Then, if the
-/--schema flag is given, use it, and if it's not given, default to the
built-in one if we're running from a bundled binary, or fall-through to
./schema.yaml in other cases.

This avoids the need for config/schema.py as a carbon-copy of the schema,
slick!
This commit is contained in:
Pim van Pelt
2022-04-05 12:40:05 +00:00
parent fdb732142a
commit 289138da94
5 changed files with 25 additions and 95 deletions

View File

@ -1,6 +1,3 @@
### NOTE(pim): This file is the source of truth for the Yamale schema validator.
### Make sure to copy this file into config/schema.py's yamale_schema
### when it is changed here.
interfaces: map(include('interface'),key=str(),required=False)
bondethernets: map(include('bondethernet'),key=str(matches='BondEthernet[0-9]+'),required=False)
loopbacks: map(include('loopback'),key=str(matches='loop[0-9]+'),required=False)