From 0673792bcca0f380ea62cabdf09cdd28488f9ba8 Mon Sep 17 00:00:00 2001 From: Rajitha Kumara Date: Wed, 27 Mar 2024 14:41:06 +0530 Subject: [PATCH] Fix policy delegation task starting issue --- .../policy/mgt/core/impl/PolicyAdministratorPointImpl.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/main/java/io/entgra/device/mgt/core/policy/mgt/core/impl/PolicyAdministratorPointImpl.java b/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/main/java/io/entgra/device/mgt/core/policy/mgt/core/impl/PolicyAdministratorPointImpl.java index 7ead0213c9..cf06ff2668 100644 --- a/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/main/java/io/entgra/device/mgt/core/policy/mgt/core/impl/PolicyAdministratorPointImpl.java +++ b/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/main/java/io/entgra/device/mgt/core/policy/mgt/core/impl/PolicyAdministratorPointImpl.java @@ -154,6 +154,10 @@ public class PolicyAdministratorPointImpl implements PolicyAdministratorPoint { //Check whether the TaskType is already registered. If not we'll register it here. if (!registeredTaskTypes.contains(PolicyManagementConstants.DELEGATION_TASK_TYPE)) { taskService.registerTaskType(PolicyManagementConstants.DELEGATION_TASK_TYPE); + // Delete init task if exists + if (taskManager.isTaskScheduled(taskName)) { + taskManager.deleteTask(taskName); + } } TaskInfo registeredTaskInfo = null;