aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFiete Ostkamp <Fiete.Ostkamp@telekom.de>2024-04-24 16:41:44 +0200
committerFiete Ostkamp <Fiete.Ostkamp@telekom.de>2024-04-24 16:46:19 +0200
commitde4e6c93f2f4038167e8b5fef92426c4daac4b83 (patch)
treec3c99b6cfaa74ab80009486ef013dbf0bc26526e
parent93a7defb8a10ac29f97d3cfd860ca12a629bdc41 (diff)
Improve error logging1.14.0
- do not log csar payload to babel on info level - log exception when PUT to aai-resources fails Issue-ID: AAI-3834 Change-Id: I524315465c79165755fb9b8062f29f4f10d876ab Signed-off-by: Fiete Ostkamp <Fiete.Ostkamp@telekom.de>
-rw-r--r--src/main/java/org/onap/aai/modelloader/entity/model/ModelArtifact.java16
-rw-r--r--src/main/java/org/onap/aai/modelloader/restclient/BabelServiceClientImpl.java4
-rw-r--r--version.properties4
3 files changed, 18 insertions, 6 deletions
diff --git a/src/main/java/org/onap/aai/modelloader/entity/model/ModelArtifact.java b/src/main/java/org/onap/aai/modelloader/entity/model/ModelArtifact.java
index fa22969..364fc78 100644
--- a/src/main/java/org/onap/aai/modelloader/entity/model/ModelArtifact.java
+++ b/src/main/java/org/onap/aai/modelloader/entity/model/ModelArtifact.java
@@ -21,18 +21,25 @@
package org.onap.aai.modelloader.entity.model;
import java.util.List;
+
+import org.onap.aai.cl.api.Logger;
+import org.onap.aai.cl.eelf.LoggerFactory;
import org.onap.aai.modelloader.config.ModelLoaderConfig;
import org.onap.aai.modelloader.entity.Artifact;
import org.onap.aai.modelloader.entity.ArtifactType;
import org.onap.aai.modelloader.restclient.AaiRestClient;
+import org.onap.aai.modelloader.service.ModelLoaderMsgs;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.client.HttpClientErrorException;
+import org.springframework.web.client.HttpServerErrorException;
public class ModelArtifact extends AbstractModelArtifact {
+ private static Logger logger = LoggerFactory.getInstance().getLogger(ModelArtifact.class);
+
private static final String AAI_MODEL_VER_SUB_URL = "/model-vers/model-ver";
private static final String FAILURE_MSG_PREFIX = "Ingestion failed for ";
@@ -121,8 +128,13 @@ public class ModelArtifact extends AbstractModelArtifact {
* @return true if the resource PUT as XML media was successful (status OK)
*/
private boolean putXmlResource(AaiRestClient aaiClient, String distId, String resourceUrl, String payload) {
- ResponseEntity<String> putResponse =
- aaiClient.putResource(resourceUrl, payload, distId, MediaType.APPLICATION_XML, String.class);
+ ResponseEntity<String> putResponse = null;
+ try {
+ putResponse =
+ aaiClient.putResource(resourceUrl, payload, distId, MediaType.APPLICATION_XML, String.class);
+ } catch (HttpClientErrorException | HttpServerErrorException e) {
+ logger.error(ModelLoaderMsgs.AAI_REST_REQUEST_ERROR, "Error putting resource: " + e.toString());
+ }
return putResponse != null && putResponse.getStatusCode() == HttpStatus.CREATED;
}
diff --git a/src/main/java/org/onap/aai/modelloader/restclient/BabelServiceClientImpl.java b/src/main/java/org/onap/aai/modelloader/restclient/BabelServiceClientImpl.java
index 474fcc6..63bd7e9 100644
--- a/src/main/java/org/onap/aai/modelloader/restclient/BabelServiceClientImpl.java
+++ b/src/main/java/org/onap/aai/modelloader/restclient/BabelServiceClientImpl.java
@@ -57,8 +57,8 @@ public class BabelServiceClientImpl implements BabelServiceClient {
@Override
public List<BabelArtifact> postArtifact(BabelRequest babelRequest, String transactionId) throws BabelServiceClientException {
- if (logger.isInfoEnabled()) {
- logger.info(ModelLoaderMsgs.BABEL_REST_REQUEST_PAYLOAD, " Artifact Name: " + babelRequest.getArtifactName()
+ if (logger.isDebugEnabled()) {
+ logger.debug(ModelLoaderMsgs.BABEL_REST_REQUEST_PAYLOAD, " Artifact Name: " + babelRequest.getArtifactName()
+ " Artifact version: " + babelRequest.getArtifactVersion() + " Artifact payload: " + babelRequest.getCsar());
}
diff --git a/version.properties b/version.properties
index b2aac49..d035ea2 100644
--- a/version.properties
+++ b/version.properties
@@ -24,8 +24,8 @@
# because they are used in Jenkins, whose plug-in doesn't support
major=1
-minor=13
-patch=6
+minor=14
+patch=0
base_version=${major}.${minor}.${patch}