Subject: | Redesign the agent runtime process |
FleetConf::Agent runs according to what was easy to code initially. It
needs some purposeful design and then needs to be reimplemented.
Basically, there are currently these phases:
1. Initialization: This phase should run as the program as being
compiled and should cause compilation to end early and the whole agent
skipped if it fails.
2. Requirements: This phase needs to run completely through, but if any
part fails, locks are not taken and we skip to Shutdown.
3. Check: This phase runs after locks have been taken and should run
completely through. If any part fails, we should skip Run and go
directly on to Cleanup.
4. Run: Locks are still held. This phase should stop as soon as a
failure occurs (no other part of run should continue if a single failure
occurs). The Cleanup phase is always run after this phase.
5. Cleanup: Locks are still held. This phase is meant to allow clean up
to occur. At this time, this phase isn't in use, but in the future, I
intend to have an exception handling command which will execute any Run
phase commands within in the cleanup phase.
Whether or not the locks are committed or rolled back depends on the
result of Run and Cleanup phase. If Run failed and Cleanup failed,
commit error. If Run failed and Cleanup suceeded, rollback. If Run
succeeded and Cleanup failed, commit. If Run succeeded and Cleanup
succeeded, commit. I.e., we may log them, but errors in the cleanup
phase don't really register. The Cleanup phase should fail if there are
no commands that run during it.
6. Shutdown: At this time, I'm not sure if this phase is necessary or
desireable. As such, I think I'm going to remove it for now until I can
find a user for it.
I would like there to be a way of changing the workflow for these phases
in a standard way eventually, but first things first.
Regards,
Sterling