This PR is currently more like an idea/RFC (request-for-comments). There is a lot of stuff missing, opening early to get feedback if it is a good idea.
The idea behind this is to not use global objects and rather pass a session object which would contain whole context (config, provisioning config, metadata, database, initialized providers). Adding the session to other objects (host, providers, transformers, outputs, actions).
I'd also unitize Host object for carrying a provisioning context. I.e. it would be initialized e.g. in following way:
loaded from DB if was created by previous run
updated from metadata (here we might intentionally fail, if metadata changed in incompatible way)
updated by transformer (req added)
update by provider (output of provisioning, deletion or out method)
saved to DB
Also the PR adds more python typing - helps with the refactoring to find areas which has type mismatch.
The envisioned benefits/purposes are:
easier unit testing (but this actually depends how other things are written)
a possibility of having 2+ provisioning session running in single process in parallel with different inputs - this makes it more friendly for usage as a library.
the usage of Host as context can make easier the future use case to add/remove host interactively (in different runs)
This PR is currently more like an idea/RFC (request-for-comments). There is a lot of stuff missing, opening early to get feedback if it is a good idea.
The idea behind this is to not use global objects and rather pass a session object which would contain whole context (config, provisioning config, metadata, database, initialized providers). Adding the session to other objects (host, providers, transformers, outputs, actions).
I'd also unitize
Host
object for carrying a provisioning context. I.e. it would be initialized e.g. in following way:Also the PR adds more python typing - helps with the refactoring to find areas which has type mismatch.
The envisioned benefits/purposes are: