diff options
author | Smokowski, Steven <steve.smokowski@att.com> | 2019-05-31 16:15:23 -0400 |
---|---|---|
committer | Benjamin, Max (mb388a) <mb388a@us.att.com> | 2019-05-31 16:15:37 -0400 |
commit | 96a2da847be40361ff8f0a27875101782fb6b80d (patch) | |
tree | 3d03f22eac888ada9c785b9d9152d54904dfc47c /adapters/mso-adapter-utils/src/main | |
parent | 89b396152a7f5ca62175d13342c1b3a1a9067ccb (diff) |
Fix issue where request was not being updated
Fix issue where request was not being updated
Change-Id: Ib4b3809797449224ac417facfaa4bf48d91a1ecb
Issue-ID: SO-1966
Signed-off-by: Benjamin, Max (mb388a) <mb388a@us.att.com>
Diffstat (limited to 'adapters/mso-adapter-utils/src/main')
2 files changed, 12 insertions, 3 deletions
diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatUtils.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatUtils.java index 683bb28726..bf6374bc2f 100644 --- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatUtils.java +++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatUtils.java @@ -350,7 +350,13 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin { cloudReq.setCloudIdentifier(stackName); cloudReq.setRequestBody(stackRequest); cloudReq.setRequestId(requestId); - foundRequest.getCloudApiRequests().add(cloudReq); + CloudApiRequests foundCloudReq = foundRequest.getCloudApiRequests().stream() + .filter(cloudReqToFind -> stackName.equals(cloudReq.getCloudIdentifier())).findAny().orElse(null); + if (foundCloudReq != null) { + foundCloudReq.setRequestBody(stackRequest); + } else { + foundRequest.getCloudApiRequests().add(cloudReq); + } requestDBClient.updateInfraActiveRequests(foundRequest); } catch (Exception e) { logger.error("Error updating in flight request with Openstack Create Request", e); diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/StackStatusHandler.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/StackStatusHandler.java index 53337b33f8..df173c002d 100644 --- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/StackStatusHandler.java +++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/StackStatusHandler.java @@ -36,9 +36,12 @@ public class StackStatusHandler { requestProcessingData.setName(stack.getStackName()); requestProcessingData.setTag("StackInformation"); requestProcessingData.setSoRequestId(requestId); + requestProcessingData.setValue(stackStatus); + requestDBClient.saveRequestProcessingData(requestProcessingData); + } else { + requestProcessingData.setValue(stackStatus); + requestDBClient.updateRequestProcessingData(requestProcessingData); } - requestProcessingData.setValue(stackStatus); - requestDBClient.saveRequestProcessingData(requestProcessingData); } catch (Exception e) { logger.warn("Error adding stack status to request database", e); } |