TWCable / grabbit

Grabbit - Fast Content Sync tool for AEM/CQ
Apache License 2.0
125 stars 64 forks source link

Workflow config IDs not disabling with AEM 6.4 #210

Open jhostet opened 6 years ago

jhostet commented 6 years ago

Simple code changes provided below to get grabbit to throw errors.

What version of AEM are you running? 6.4.1.0

How do you produce the issue? Install the below packages and do a content sync. Grabbit-7.1.4.zip Grabbit-Apache-Sling-Login-Whitelist-1.0.zip Grabbit-Deserialization-Firewall-Configuration-1.0.zip Sun-Misc-Fragment-Bundle-1.0.0.zip

Does the issue occur consistently? Yes, code specifically looks for "/etc/workflows" and AEM 6.4 moves workflow launchers to /libs/settings or /conf/global/ https://helpx.adobe.com/experience-manager/6-4/sites/deploying/using/all-repository-restructuring-in-aem-6-4.html#WorkflowLaunchers

Any additional details? After modifying WorkflowOffTasklet and WorkflowOnTasklet to only check that config IDs were provided. In DefaultWorkFlowManager I wrapped editConfigEntry in a try catch and printed a stack trace: com.adobe.granite.workflow.core.launcher.WorkflowLauncherImpl Error editing launcher config entry javax.jcr.AccessDeniedException: OakAccess0000: Access denied Full stack trace can be provided.


index b8e206d..d3cc798 100644
--- a/src/main/groovy/com/twcable/grabbit/client/batch/workflows/impl/DefaultWorkFlowManager.groovy
+++ b/src/main/groovy/com/twcable/grabbit/client/batch/workflows/impl/DefaultWorkFlowManager.groovy
@@ -18,6 +18,7 @@ package com.twcable.grabbit.client.batch.workflows.impl

 import com.day.cq.workflow.launcher.ConfigEntry
 import com.day.cq.workflow.launcher.WorkflowLauncher
+import javax.jcr.RepositoryException
 import com.twcable.grabbit.client.batch.workflows.WorkflowManager
 import groovy.transform.CompileStatic
 import groovy.transform.WithWriteLock
@@ -118,6 +119,10 @@ class DefaultWorkFlowManager implements WorkflowManager {
      */
     @WithWriteLock
     private void updateConfig(final WorkflowID configId, final ConfigEntry configEntry) {
+      try {
         workflowLauncher.editConfigEntry(configId, configEntry)
+        } catch(RepositoryException e) {
+          log.debug "${e.printStackTrace()}"
+        }
     }
 }
diff --git a/src/main/groovy/com/twcable/grabbit/client/batch/steps/workflows/WorkflowOffTasklet.groovy b/src/main/groovy/com/twcable/grabbit/client/batch/steps/workflows/WorkflowOffTasklet.groovy
index 3013935..40c7d4b 100644
--- a/src/main/groovy/com/twcable/grabbit/client/batch/steps/workflows/WorkflowOffTasklet.groovy
+++ b/src/main/groovy/com/twcable/grabbit/client/batch/steps/workflows/WorkflowOffTasklet.groovy
@@ -46,7 +46,7 @@ class WorkflowOffTasklet implements Tasklet {

     @Override
     RepeatStatus execute(StepContribution contribution, ChunkContext chunkContext) throws Exception {
-        if (!workflowConfigs || !workflowConfigs.contains("/etc/workflow") /* temporary for testing */) {
+        if (!workflowConfigs) {
             //nothing to process as there are no workflow configs for the current path
             log.info "Nothing to process..."
             return RepeatStatus.FINISHED

diff --git a/src/main/groovy/com/twcable/grabbit/client/batch/steps/workflows/WorkflowOnTasklet.groovy b/src/main/groovy/com/twcable/grabbit/client/batch/steps/workflows/WorkflowOnTasklet.groovy
index b540934..092cc08 100644
--- a/src/main/groovy/com/twcable/grabbit/client/batch/steps/workflows/WorkflowOnTasklet.groovy
+++ b/src/main/groovy/com/twcable/grabbit/client/batch/steps/workflows/WorkflowOnTasklet.groovy
@@ -46,7 +46,7 @@ class WorkflowOnTasklet implements Tasklet {

     @Override
     RepeatStatus execute(StepContribution contribution, ChunkContext chunkContext) throws Exception {
-        if (!workflowConfigs || !workflowConfigs.contains("/etc/workflow") /* temporary for testing */) {
+        if (!workflowConfigs) {
             //nothing to process as there are no workflow configs for the current path
             log.info "Nothing to process..."
             return RepeatStatus.FINISHED