Migrating onto the SDK
The runner and every module moved onto suil.sdk, which
03-sdk.md specifies. The old libs and models are gone, and a
module imports suil only through suil.sdk and suil.testing. Behaviour on
hosts did not change: the same config queues the same operations. This
document records the step; it has landed.
Before
- The runner and
suil/testing.pyimported a flat package of libs and a models file next to it. - The runner called the free functions of a module by name:
deploy,expected,checkand the one that listed the module's files. - The public view masked secrets by value.
errors_handlerinsuil/errors.pyknew only the runner's own base error, so it logged an sdkErrora second time, with a traceback.- Every module with code imported those libs, models or errors, and was
listed in
PENDINGofsuil/tests/test_modules_import_sdk.py.
Runner
The runner takes everything from suil.sdk:
get_configfor the model andget_publicfor the public view;load_classandcheck_facterbefore anything connects, and oneModule(config)per node and module;run_code,run_drift,run_checkandget_fileson that instance, andcollect_factsthrough theFacterbootstrap.
While the modules moved, one still in PENDING kept running through the old
paths: its free functions and its collector as a script. errors_handler
treats suil.sdk.errors.Error as its own, and suil.testing loads modules
through suil.sdk.
Modules
Every module moved in one commit:
- the free functions of
code/main.pybecame methods of its oneModule, and the function that listed its files becamefiles(); code/config.pysubclassessuil.sdk.Config, and every secret field is typedSecret;facts/collector.pybecame oneFactersubclass;- the tests import only
suil.sdkandsuil.testing, which gives themget_orderandget_requires; - the module left
PENDING.
test_modules_import_sdk.py held the line meanwhile: it failed on a module
outside PENDING that imported more, and on a module in PENDING that no
longer did. It still fails on any module that imports more.
Removal
Once PENDING was empty, the old paths of the runner, the old libs and
models and the tests in suil/tests/ that suil/tests/sdk/ copies were
deleted, and with them PENDING itself.
Acceptance
- Every module implements its interfaces and imports suil only through
suil.sdkandsuil.testing. suil apply --dry-runfor a full role queues the same operations as before.- The public view of every node in
.runs/is identical to the one built by value before.