diff options
author | rameshiyer27 <ramesh.murugan.iyer@est.tech> | 2021-06-15 18:22:04 +0100 |
---|---|---|
committer | rameshiyer27 <ramesh.murugan.iyer@est.tech> | 2021-06-16 11:03:26 +0100 |
commit | 43fb6c9a683efb014c40d5736419cb0085556642 (patch) | |
tree | 0777ca250d3c2d0af417d29e46e7c5840b3bd429 /participant/participant-impl/participant-impl-kubernetes/src/main | |
parent | 399e86d983057304673f701a22b172a69d5aa7dc (diff) |
Fix CLAMP build failure and kub-participant module startup issue.
Initialising ParticipantK8sParameters in the constructor to fix Null pointer Exception in kub-participant module.
Constructor cannot use autowired properties.
Updated pfDao getFiltered method signature to align with latest code in policy models.
Issue-ID: POLICY-3240
Signed-off-by: zrrmmua <ramesh.murugan.iyer@est.tech>
Change-Id: I9405c1e050b31b153ee53829ffece9f4be27818e
Diffstat (limited to 'participant/participant-impl/participant-impl-kubernetes/src/main')
3 files changed, 12 insertions, 12 deletions
diff --git a/participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/controlloop/participant/kubernetes/helm/HelmClient.java b/participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/controlloop/participant/kubernetes/helm/HelmClient.java index 456122f3d..1b7599ce9 100644 --- a/participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/controlloop/participant/kubernetes/helm/HelmClient.java +++ b/participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/controlloop/participant/kubernetes/helm/HelmClient.java @@ -113,8 +113,6 @@ public class HelmClient { static String executeCommand(ProcessBuilder processBuilder) throws ServiceException { var commandStr = toString(processBuilder); - processBuilder.redirectInput(ProcessBuilder.Redirect.DISCARD); - try { var process = processBuilder.start(); process.waitFor(); diff --git a/participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/controlloop/participant/kubernetes/service/ChartStore.java b/participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/controlloop/participant/kubernetes/service/ChartStore.java index 2d0ce7a83..041c0c810 100644 --- a/participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/controlloop/participant/kubernetes/service/ChartStore.java +++ b/participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/controlloop/participant/kubernetes/service/ChartStore.java @@ -51,8 +51,7 @@ public class ChartStore { private static final StandardCoder STANDARD_CODER = new StandardCoder(); - @Autowired - private ParticipantK8sParameters participantK8sParameters; + private final ParticipantK8sParameters participantK8sParameters; /** * The chartStore map contains chart name as key & ChartInfo as value. @@ -62,7 +61,8 @@ public class ChartStore { /** * Constructor method. */ - public ChartStore() { + public ChartStore(@Autowired ParticipantK8sParameters participantK8sParameters) { + this.participantK8sParameters = participantK8sParameters; this.restoreFromLocalFileSystem(); } @@ -177,12 +177,11 @@ public class ChartStore { } private synchronized void restoreFromLocalFileSystem() { - Path localChartDirectoryPath = Paths.get(participantK8sParameters.getLocalChartDirectory()); - try { + Path localChartDirectoryPath = Paths.get(participantK8sParameters.getLocalChartDirectory()); Files.createDirectories(localChartDirectoryPath); restoreFromLocalFileSystem(localChartDirectoryPath); - } catch (IOException ioe) { + } catch (Exception ioe) { LOGGER.warn("Could not restore charts from local file system: {}", ioe); } } @@ -194,8 +193,11 @@ public class ChartStore { @Override public FileVisitResult visitFile(Path localChartFile, BasicFileAttributes attrs) throws IOException { try { - ChartInfo chart = STANDARD_CODER.decode(localChartFile.toFile(), ChartInfo.class); - localChartMap.put(key(chart), chart); + // Decode only the json file excluding the helm charts + if (localChartFile.endsWith(participantK8sParameters.getInfoFileName())) { + ChartInfo chart = STANDARD_CODER.decode(localChartFile.toFile(), ChartInfo.class); + localChartMap.put(key(chart), chart); + } return FileVisitResult.CONTINUE; } catch (CoderException ce) { throw new IOException("Error decoding chart file", ce); diff --git a/participant/participant-impl/participant-impl-kubernetes/src/main/resources/config/KubernetesParticipantConfig.json b/participant/participant-impl/participant-impl-kubernetes/src/main/resources/config/KubernetesParticipantConfig.json index 620e05552..e854a9375 100644 --- a/participant/participant-impl/participant-impl-kubernetes/src/main/resources/config/KubernetesParticipantConfig.json +++ b/participant/participant-impl/participant-impl-kubernetes/src/main/resources/config/KubernetesParticipantConfig.json @@ -49,8 +49,8 @@ "implementation":"org.onap.policy.models.provider.impl.DatabasePolicyModelsProviderImpl", "databaseDriver":"org.mariadb.jdbc.Driver", "databaseUrl":"jdbc:mariadb://localhost:3306/controlloop", - "databaseUser":"admin", - "databasePassword":"passme", + "databaseUser":"policy", + "databasePassword":"P01icY", "persistenceUnit":"ToscaConceptTest" } } |