From: Toine Siebelink Date: Fri, 1 Jul 2022 08:08:14 +0000 (+0000) Subject: Merge "Allow Module Re-Sync" X-Git-Tag: 3.1.0~84 X-Git-Url: https://gerrit.onap.org/r/gitweb?a=commitdiff_plain;h=b93d6df7f4304580e0f2029cbd449ba863d1ef02;p=cps.git Merge "Allow Module Re-Sync" --- b93d6df7f4304580e0f2029cbd449ba863d1ef02 diff --cc cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/inventory/sync/ModuleSyncWatchdog.java index ac53d881c1,9383ac1ef7..6ec44197d2 --- a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/inventory/sync/ModuleSyncWatchdog.java +++ b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/inventory/sync/ModuleSyncWatchdog.java @@@ -55,15 -53,19 +55,16 @@@ public class ModuleSyncWatchdog final String cmHandleId = advisedCmHandle.getId(); final CompositeState compositeState = inventoryPersistence.getCmHandleState(cmHandleId); try { + moduleSyncService.deleteSchemaSetIfExists(advisedCmHandle); moduleSyncService.syncAndCreateSchemaSetAndAnchor(advisedCmHandle); - compositeState.setCmHandleState(CmHandleState.READY); + setCompositeStateToReadyWithInitialDataStoreSyncState().accept(compositeState); } catch (final Exception e) { - compositeState.setCmHandleState(CmHandleState.LOCKED); + setCompositeStateToLocked().accept(compositeState); syncUtils.updateLockReasonDetailsAndAttempts(compositeState, - LockReasonCategory.LOCKED_MISBEHAVING, - e.getMessage()); + LockReasonCategory.LOCKED_MISBEHAVING, e.getMessage()); } - compositeState.setLastUpdateTimeNow(); inventoryPersistence.saveCmHandleState(cmHandleId, compositeState); - log.info("{} is now in {} state", cmHandleId, - advisedCmHandle.getCompositeState().getCmHandleState()); + log.debug("{} is now in {} state", cmHandleId, compositeState.getCmHandleState().name()); advisedCmHandle = syncUtils.getAnAdvisedCmHandle(); } log.debug("No Cm-Handles currently found in an ADVISED state");