Skip to content

Commit

Permalink
Fix op. result handling in provisioning.addObject
Browse files Browse the repository at this point in the history
(fixes TestSanity.test006reimportResourceDummy)
  • Loading branch information
mederly committed Jun 29, 2019
1 parent 32bf0ec commit b755271
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
Expand Up @@ -942,7 +942,6 @@ private <T extends ObjectType, F extends ObjectType> PrismObject<T> executeDelta
PrismObject<T> objectAfterModification = null;

try {

if (objectDelta.getChangeType() == ChangeType.ADD) {
objectAfterModification = executeAddition(objectDelta, context, objectContext, options, resource, task, result);
} else if (objectDelta.getChangeType() == ChangeType.MODIFY) {
Expand Down
Expand Up @@ -318,8 +318,14 @@ public <T extends ObjectType> String addObject(PrismObject<T> object, OperationP
if (ProvisioningOperationOptions.isOverwrite(options)){
addOptions = RepoAddOptions.createOverwrite();
}
oid = cacheRepositoryService.addObject(object, addOptions, result);
result.computeStatus();
try {
oid = cacheRepositoryService.addObject(object, addOptions, result);
} catch (Throwable t) {
result.recordFatalError(t);
throw t;
} finally {
result.computeStatusIfUnknown();
}
}

result.cleanupResult();
Expand Down
Expand Up @@ -922,10 +922,10 @@ public void test006reimportResourceDummy() throws Exception{
} catch (FaultMessage ex) {
LOGGER.info("fault {}", ex.getFaultInfo());
LOGGER.info("fault {}", ex.getCause());
if (ex.getFaultInfo() instanceof ObjectAlreadyExistsFaultType){
if (ex.getFaultInfo() instanceof ObjectAlreadyExistsFaultType) {
// this is OK, we expect this
} else{
fail("Expected object already exists exception, but haven't got one.");
fail("Expected object already exists exception, but got: " + ex.getFaultInfo());
}

}
Expand Down

0 comments on commit b755271

Please sign in to comment.