X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;ds=sidebyside;f=heat%2FvFW_CNF_CDS%2Ftemplates%2Fcba%2FScripts%2Fkotlin%2FConfigDeploy.kt;h=861cdf6652a8c24810f52f42430f2df47bafe8d5;hb=d2c5f361fa3a246dfa23c2c582ec498322a97282;hp=c4849601bfe5c928c8bb3dac2f3b42be4a1221e5;hpb=1ff5827ffde7af1d8aed23890a571455300ade6d;p=demo.git diff --git a/heat/vFW_CNF_CDS/templates/cba/Scripts/kotlin/ConfigDeploy.kt b/heat/vFW_CNF_CDS/templates/cba/Scripts/kotlin/ConfigDeploy.kt index c4849601..861cdf66 100644 --- a/heat/vFW_CNF_CDS/templates/cba/Scripts/kotlin/ConfigDeploy.kt +++ b/heat/vFW_CNF_CDS/templates/cba/Scripts/kotlin/ConfigDeploy.kt @@ -1,5 +1,5 @@ /* - * Copyright © 2020 Aarna Networks, Inc. + * Copyright © 2021 Orange * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,44 +16,33 @@ package org.onap.ccsdk.cds.blueprintsprocessor.services.execution.scripts -import com.fasterxml.jackson.databind.node.ObjectNode import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.ExecutionServiceInput import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.storedContentFromResolvedArtifactNB -import org.onap.ccsdk.cds.blueprintsprocessor.rest.BasicAuthRestClientProperties -import org.onap.ccsdk.cds.blueprintsprocessor.rest.RestClientProperties -import org.onap.ccsdk.cds.blueprintsprocessor.rest.service.BasicAuthRestClientService -import org.onap.ccsdk.cds.blueprintsprocessor.rest.service.BlueprintWebClientService import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.AbstractScriptComponentFunction -import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils import org.slf4j.LoggerFactory -import org.springframework.http.HttpMethod -import org.springframework.web.client.RestTemplate open class ConfigDeploy : AbstractScriptComponentFunction() { private val log = LoggerFactory.getLogger(ConfigDeploy::class.java)!! - override suspend fun processNB(executionRequest: ExecutionServiceInput) { - - /* - * Resolution key will come as part of config-deploy request payload. - */ + override fun getName(): String { + return "ConfigDeploy" + } + override suspend fun processNB(executionRequest: ExecutionServiceInput) { val resolution_key = getDynamicProperties("resolution-key").asText() - log.info("Got the resolution_key: $resolution_key from config-deploy going to retrive the data from DB") + log.info("Got the resolution_key: $resolution_key from config-deploy going to retrieve the data from DB") + val prefix = "config-deploy" // used in the config-assign resolution - // Read the config-assing data using the resolution key + prefix name for the template - // We can select the given configuration using the resolution_key - val prefix = "cnf" val payload = storedContentFromResolvedArtifactNB(resolution_key, prefix) log.info("cnf configuration data from DB : \n$payload\n") println("Run config-deploy") println("$payload") - } override suspend fun recoverNB(runtimeException: RuntimeException, executionRequest: ExecutionServiceInput) { log.info("Executing Recovery") + this.addError("${runtimeException.message}") } }