You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@unomi.apache.org by "Francois Gerthoffert (Jira)" <ji...@apache.org> on 2024/08/26 12:54:00 UTC

[jira] [Updated] (UNOMI-847) Unable to delete a groovy action / Issue when registering Groovy actions

     [ https://issues.apache.org/jira/browse/UNOMI-847?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Francois Gerthoffert updated UNOMI-847:
---------------------------------------
    Summary: Unable to delete a groovy action / Issue when registering Groovy actions  (was: Unable to delete a groovy action / Issue when registering new actions)

> Unable to delete a groovy action / Issue when registering Groovy actions
> ------------------------------------------------------------------------
>
>                 Key: UNOMI-847
>                 URL: https://issues.apache.org/jira/browse/UNOMI-847
>             Project: Apache Unomi
>          Issue Type: Bug
>    Affects Versions: unomi-2.1.0, unomi-2.4.0, unomi-2.5.0
>            Reporter: Francois Gerthoffert
>            Priority: Major
>             Fix For: unomi-2.6.0
>
>
> There's an issue in the way Groovy Actions are registered via the REST API, causing further issues downstream when trying to call actions (delete and other uses).
> Create a groovy action, call it hello-world.groovy (from the doc):
> {code:java}
> @Action(id = "helloWorldGroovyAction",
>         actionExecutor = "groovy:helloWorldAction",
>         parameters = [@Parameter(id = "location", type = "string", multivalued = false)])
> def execute() {
>     logger.info("Hello {}", action.getParameterValues().get("location"))
>     EventService.NO_CHANGE
> }
> {code}
> h2. Steps to reproduce:
>  * Start unomi 2.5.0
>  * Submit the action:
>  ** curl -X POST 'http://localhost:8181/cxs/groovyActions' --user karaf:karaf --form file=@hello-world.groovy
>  ** In the logs:
> {code:java}
> 04-jexperience-jcustomer-1      | 2024-08-26T12:16:57,786 | INFO  | qtp656712048-259 | GroovyActionsServiceImpl         | 213 - org.apache.unomi.groovy-actions-services - 2.4.0 |  The script hello-world has been persisted. 
> 04-jexperience-jcustomer-1      | 2024-08-26T12:16:57,786 | INFO  | qtp656712048-259 | GroovyActionsServiceImpl         | 213 - org.apache.unomi.groovy-actions-services - 2.4.0 |  The script hello-world has been loaded.  {code}
>  * List the actions using the karaf shell: "unomi:action-list"
> {code:java}
> karaf@root()> unomi:action-list                                                                                                                                                               
> Id                                      │ Name                                    │ System tags
> ────────────────────────────────────────┼─────────────────────────────────────────┼──────────────────────────────────────────────────────────────────
> addToListsAction                        │ addToListsAction                        │ profileTags,availableToEndUser,demographic
> allEventToProfilePropertiesAction       │ allEventToProfilePropertiesAction       │ profileTags,event
> copyPropertiesAction                    │ copyPropertiesAction                    │ profileTags,event
> evaluateProfileAgeAction                │ evaluateProfileAgeAction                │ profileTags,event
> evaluateProfileSegmentsAction           │ evaluateProfileSegmentsAction           │ profileTags,event
> evaluateVisitPropertiesAction           │ evaluateVisitPropertiesAction           │ profileTags
> eventToProfilePropertyAction            │ eventToProfilePropertyAction            │ profileTags,event
> helloWorldGroovyAction                  │ helloWorldGroovyAction                  │
> incrementPropertyAction                 │ incrementPropertyAction                 │ profileTags
> mergeProfilesOnPropertyAction           │ mergeProfilesOnPropertyAction           │ profileTags,demographic
> modifyConsentAction                     │ modifyConsentAction                     │ profileTags,demographic
> requestHeaderToProfilePropertyAction    │ requestHeaderToProfilePropertyAction    │ profileTags,event
> requestParameterToProfilePropertyAction │ requestParameterToProfilePropertyAction │ profileTags,event
> sendEventAction                         │ sendEventAction                         │ profileTags,event
> sendMailAction                          │ sendMailAction                          │ allowMultipleInstances,profileTags,availableToEndUser,event
> setEventOccurenceCountAction            │ setEventOccurenceCountAction            │ profileTags,demographic
> setPropertyAction                       │ setPropertyAction                       │ allowMultipleInstances,profileTags,availableToEndUser,demographic
> setRemoteHostInfoAction                 │ setRemoteHostInfoAction                 │ profileTags,event
> updatePropertiesAction                  │ updatePropertiesAction                  │ profileTags,demographic {code}
>  * Notice the action is now listed with id "helloWorldGroovyAction"
>  * Delete the action:
>  ** curl -X DELETE 'http://localhost:8181/cxs/groovyActions/helloWorldGroovyAction' --user karaf:karaf
>  * List the actions using the karaf shell: "unomi:action-list"
>  ** {color:#ff0000}*The action is still listed, no errors in unomi to indicate that the deletion failed*{color}
> h2. Desired behavior
> It should be possible to delete a groovy action using DELETE
> h2. Workaround
> Note that it's possible to get groovy actions to work properly by submitting an action with a filename matching the desired id.
>  * Start unomi 2.5.0
>  * Submit the action:
>  ** curl -X POST 'http://localhost:8181/cxs/groovyActions' --user karaf:karaf --form {color:#ff0000}file=@helloWorldGroovyAction.groovy{color}
>  ** In the logs:
> {code:java}
> 04-jexperience-jcustomer-1      | 2024-08-26T12:26:17,284 | INFO  | qtp1534497314-264 | GroovyActionsServiceImpl         | 213 - org.apache.unomi.groovy-actions-services - 2.4.0 |  The script helloWorldGroovyAction has been persisted. 
> 04-jexperience-jcustomer-1      | 2024-08-26T12:26:17,285 | INFO  | qtp1534497314-264 | GroovyActionsServiceImpl         | 213 - org.apache.unomi.groovy-actions-services - 2.4.0 |  The script helloWorldGroovyAction has been loaded. {code}
>  * List the actions using the karaf shell: "unomi:action-list"
> {code:java}
> karaf@root()> unomi:action-list                                                                                                                                                               
> Id                                      │ Name                                    │ System tags
> ────────────────────────────────────────┼─────────────────────────────────────────┼──────────────────────────────────────────────────────────────────
> addToListsAction                        │ addToListsAction                        │ profileTags,availableToEndUser,demographic
> allEventToProfilePropertiesAction       │ allEventToProfilePropertiesAction       │ profileTags,event
> copyPropertiesAction                    │ copyPropertiesAction                    │ profileTags,event
> evaluateProfileAgeAction                │ evaluateProfileAgeAction                │ profileTags,event
> evaluateProfileSegmentsAction           │ evaluateProfileSegmentsAction           │ profileTags,event
> evaluateVisitPropertiesAction           │ evaluateVisitPropertiesAction           │ profileTags
> eventToProfilePropertyAction            │ eventToProfilePropertyAction            │ profileTags,event
> helloWorldGroovyAction                  │ helloWorldGroovyAction                  │
> incrementPropertyAction                 │ incrementPropertyAction                 │ profileTags
> mergeProfilesOnPropertyAction           │ mergeProfilesOnPropertyAction           │ profileTags,demographic
> modifyConsentAction                     │ modifyConsentAction                     │ profileTags,demographic
> requestHeaderToProfilePropertyAction    │ requestHeaderToProfilePropertyAction    │ profileTags,event
> requestParameterToProfilePropertyAction │ requestParameterToProfilePropertyAction │ profileTags,event
> sendEventAction                         │ sendEventAction                         │ profileTags,event
> sendMailAction                          │ sendMailAction                          │ allowMultipleInstances,profileTags,availableToEndUser,event
> setEventOccurenceCountAction            │ setEventOccurenceCountAction            │ profileTags,demographic
> setPropertyAction                       │ setPropertyAction                       │ allowMultipleInstances,profileTags,availableToEndUser,demographic
> setRemoteHostInfoAction                 │ setRemoteHostInfoAction                 │ profileTags,event
> updatePropertiesAction                  │ updatePropertiesAction                  │ profileTags,demographic {code}
>  * Notice the action is now listed with id "helloWorldGroovyAction"
>  * Delete the action:
>  ** curl -X DELETE 'http://localhost:8181/cxs/groovyActions/helloWorldGroovyAction' --user karaf:karaf
>  ** Note: No logs are present (INFO) to indicate that the action was deleted.
>  * List the actions using the karaf shell: "unomi:action-list"
>  * The action is properly deleted
> {code:java}
> karaf@root()> unomi:action-list                                                                                                                                                               
> Id                                      │ Name                                    │ System tags
> ────────────────────────────────────────┼─────────────────────────────────────────┼──────────────────────────────────────────────────────────────────
> addToListsAction                        │ addToListsAction                        │ profileTags,availableToEndUser,demographic
> allEventToProfilePropertiesAction       │ allEventToProfilePropertiesAction       │ profileTags,event
> copyPropertiesAction                    │ copyPropertiesAction                    │ profileTags,event
> evaluateProfileAgeAction                │ evaluateProfileAgeAction                │ profileTags,event
> evaluateProfileSegmentsAction           │ evaluateProfileSegmentsAction           │ profileTags,event
> evaluateVisitPropertiesAction           │ evaluateVisitPropertiesAction           │ profileTags
> eventToProfilePropertyAction            │ eventToProfilePropertyAction            │ profileTags,event
> incrementPropertyAction                 │ incrementPropertyAction                 │ profileTags
> mergeProfilesOnPropertyAction           │ mergeProfilesOnPropertyAction           │ profileTags,demographic
> modifyConsentAction                     │ modifyConsentAction                     │ profileTags,demographic
> requestHeaderToProfilePropertyAction    │ requestHeaderToProfilePropertyAction    │ profileTags,event
> requestParameterToProfilePropertyAction │ requestParameterToProfilePropertyAction │ profileTags,event
> sendEventAction                         │ sendEventAction                         │ profileTags,event
> sendMailAction                          │ sendMailAction                          │ allowMultipleInstances,profileTags,availableToEndUser,event
> setEventOccurenceCountAction            │ setEventOccurenceCountAction            │ profileTags,demographic
> setPropertyAction                       │ setPropertyAction                       │ allowMultipleInstances,profileTags,availableToEndUser,demographic
> setRemoteHostInfoAction                 │ setRemoteHostInfoAction                 │ profileTags,event
> updatePropertiesAction                  │ updatePropertiesAction                  │ profileTags,demographic {code}
> Note that it seems to be broken on all unomi 2x versions, although error is different on 2.1.0
> {code:java}
> curl -X DELETE 'http://localhost:8181/cxs/groovyActions/helloWorldGroovyAction' --user karaf:karaf 
> {"errorMessage":"internalServerError"}%   
> {code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)