Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API request - 'executeWithInstallHookHistory' but for multiple scripts giving single history entry #238

Open
krystian-panek-vmltech opened this issue Oct 5, 2024 · 0 comments

Comments

@krystian-panek-vmltech
Copy link

Hi :)

This request is kinda continuation of #172

consider following code being a part of ResourceChangeListener:

    private void executeScripts(List<String> scripts) {
        try {
            var history = aecu.createHistoryEntry();
            try {
                for (var groovyScriptPath : scripts) {
                    try {
                        var result = aecu.execute(groovyScriptPath);
                        //var result = aecu.executeWithInstallHookHistory(groovyScriptPath);
                        history = aecu.storeExecutionInHistory(history, result);
                    } catch (AecuException e) {
                        LOG.error("AECU script '%s' execution error '{}'", groovyScriptPath, e);
                    }
                }
            } finally {
                aecu.finishHistoryEntry(history);
            }
        } catch (AecuException e) {
            LOG.error("AECU scripts runner error", e);
        }
    }

since execute does not check hasBeenExecutedBefore and there is only executeWithInstallHookHistory which does that check, it's impossible (?) to group multiple scripts together to have single HistoryEntry and still idempotently execute scripts (on change, once, etc)

could we update AECU API to address this issue? I am asking because AECU history does not look nice when using executeWithInstallHookHistory in loop (all entries contain 0/1 scripts which looks quite messy)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant