summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorromaingimbert <romain.gimbert@orange.com>2019-05-24 11:09:37 +0200
committerromaingimbert <romain.gimbert@orange.com>2019-05-24 11:09:37 +0200
commit41b02ea1f4183df5394421948f664d89e1a56ec1 (patch)
tree24bb86d8ca30c5efc11c12bbe2a0a4ec0026cfbe
parent3d3d27326b311e024434cad7ac5151c43be3f88f (diff)
permissions failing when tosca parsing
-fix dockerfile -add check in sdcclient Change-Id: I84fcbf6289a692168def37ee50c3c3b33945e15f Issue-ID: EXTAPI-249 Signed-off-by: romaingimbert <romain.gimbert@orange.com>
-rw-r--r--Dockerfile2
-rw-r--r--src/main/java/org/onap/nbi/apis/servicecatalog/SdcClient.java8
2 files changed, 8 insertions, 2 deletions
diff --git a/Dockerfile b/Dockerfile
index 0566534..adeee9e 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -22,6 +22,8 @@ ADD target/$PKG_FILENAME app.jar
RUN addgroup -S appgroup
RUN adduser -S appuser -G appgroup
+RUN mkdir temptoscafile
+RUN chown appuser:appgroup temptoscafile/
COPY src/main/resources/certificate /certs
ARG CERT_PASS=changeit
diff --git a/src/main/java/org/onap/nbi/apis/servicecatalog/SdcClient.java b/src/main/java/org/onap/nbi/apis/servicecatalog/SdcClient.java
index 0be415c..2e6893d 100644
--- a/src/main/java/org/onap/nbi/apis/servicecatalog/SdcClient.java
+++ b/src/main/java/org/onap/nbi/apis/servicecatalog/SdcClient.java
@@ -92,7 +92,6 @@ public class SdcClient {
String callUrl = sdcGetUrl.replace("{id}", id);
UriComponentsBuilder callURLFormated = UriComponentsBuilder.fromHttpUrl(callUrl);
-
ResponseEntity<Object> response = callSdc(callURLFormated.build().encode().toUri());
return (LinkedHashMap) response.getBody();
@@ -130,8 +129,12 @@ public class SdcClient {
UriComponentsBuilder callURI = UriComponentsBuilder.fromHttpUrl(urlBuilder.toString());
+ File directory = new File("temptoscafile");
+ if (! directory.exists()){
+ directory.mkdir();
+ }
- String fileName = System.currentTimeMillis() + "tosca.csar";
+ String fileName = "temptoscafile/"+System.currentTimeMillis() + "tosca.csar";
ResponseEntity<byte[]> response = callSdcWithAttachment(callURI.build().encode().toUri());
File toscaFile = new File(fileName);
try {
@@ -178,6 +181,7 @@ public class SdcClient {
private ResponseEntity<Object> callSdc(URI callURI) {
ResponseEntity<Object> response =
restTemplate.exchange(callURI, HttpMethod.GET, buildRequestHeader(), Object.class);
+
if(LOGGER.isDebugEnabled()) {
LOGGER.debug("response body : {} ",response.getBody().toString());
}