Closed senn closed 2 years ago
The hook history is not exposed at the moment. You could use AecuServiceMBean service with executeWithHistory method.
Using the MBean works. Sadly it's also in aeco.core
and not aecu.api
. Bur it's ok because this way I could remove all of the boilerplate code. Thanks for the tip.
One remark though: with the old approach, executing my scripts took max 2 secs. Using the MBean it took over a minute. Any idea why?
With 5.3 we plan to add a similar function in AecuService. About the duration, running via JMX is fast. Maybe it is some other issue. Check the AECU history if the script itself is running slow.
I've been working on implementing a way to trigger the migration without using installhooks (see #171).
I actually got something working using this approach
I do however have a problem/issue/question about the execution history and how it is used.
I got this all working by making my listener call
AecuService.execute
. However, this method does not take into account all execution history. I was able to fix this in 2 separate ways:aecu.core
and use theHookExecutionHistory
class + create the methods that the InstallHook usually uses (getScriptsForExecution, shouldExecute, wasNotExecuted, ...).ExecutionHistory
or similar myself and just copy the contents fromHookExecutionHistory
. This eliminates the need for theaecu.core
dependency. I still need to create the same boilerplate code myself (getScriptsForExecution, shouldExecute, wasNotExecuted, ...).Since we don't want to use the
aecu.core
dependency I've currently settled for option 2.However, I think this code belongs in the
AecuService
so it can be used from anywhere, whatever the trigger is (installhook or other), without having to write the ExecutionHistory logic yourself everytime.This my class (redacted):
Unless I'm approaching this incorrectly and there's a better way to get all script candidates taking into account their previous execution history?
EDIT: if you want to test this class, just provide a service user
aecu-migration-trigger-user
with read+write on /var and /conf and map it to serviceaecu-migration-trigger