aboutsummaryrefslogtreecommitdiffstats
path: root/tutorials/ApacheCNF/templates/cba/Scripts/kotlin
diff options
context:
space:
mode:
Diffstat (limited to 'tutorials/ApacheCNF/templates/cba/Scripts/kotlin')
-rw-r--r--tutorials/ApacheCNF/templates/cba/Scripts/kotlin/ConfigDeploySetup.kt19
-rw-r--r--tutorials/ApacheCNF/templates/cba/Scripts/kotlin/K8sHealthCheck.kt3
-rw-r--r--tutorials/ApacheCNF/templates/cba/Scripts/kotlin/SimpleStatusCheck.kt3
3 files changed, 14 insertions, 11 deletions
diff --git a/tutorials/ApacheCNF/templates/cba/Scripts/kotlin/ConfigDeploySetup.kt b/tutorials/ApacheCNF/templates/cba/Scripts/kotlin/ConfigDeploySetup.kt
index 77d86d04..f925be06 100644
--- a/tutorials/ApacheCNF/templates/cba/Scripts/kotlin/ConfigDeploySetup.kt
+++ b/tutorials/ApacheCNF/templates/cba/Scripts/kotlin/ConfigDeploySetup.kt
@@ -70,17 +70,22 @@ open class ConfigDeploySetup() : ResourceAssignmentProcessor() {
}
}
} else if (executionRequest.name == "replica-count") {
- var value = raRuntimeService.getInputValue(executionRequest.name)
retValue = "1"
- if (!value.isNullOrMissing()) {
- retValue = value.asText()
- } else {
- value = raRuntimeService.getInputValue("data")
+ try {
+ var value = raRuntimeService.getInputValue(executionRequest.name)
if (!value.isNullOrMissing()) {
- if (value["replicaCount"] != null) {
- retValue = value["replicaCount"].asText()
+ retValue = value.asText()
+ } else {
+ value = raRuntimeService.getInputValue("data")
+ if (!value.isNullOrMissing()) {
+ if (value["replicaCount"] != null) {
+ retValue = value["replicaCount"].asText()
+ }
}
}
+ } catch (e: Exception) {
+ log.error(e.message, e)
+ log.info("Setting default replica count: 1")
}
} else if (executionRequest.name == "config-deploy-setup") {
val modulesSdnc = raRuntimeService.getResolutionStore("vf-modules-list-sdnc")["vf-modules"]
diff --git a/tutorials/ApacheCNF/templates/cba/Scripts/kotlin/K8sHealthCheck.kt b/tutorials/ApacheCNF/templates/cba/Scripts/kotlin/K8sHealthCheck.kt
index dd87c6f5..30b4d96b 100644
--- a/tutorials/ApacheCNF/templates/cba/Scripts/kotlin/K8sHealthCheck.kt
+++ b/tutorials/ApacheCNF/templates/cba/Scripts/kotlin/K8sHealthCheck.kt
@@ -119,7 +119,6 @@ open class K8sHealthCheck : AbstractScriptComponentFunction() {
}
override suspend fun recoverNB(runtimeException: RuntimeException, executionRequest: ExecutionServiceInput) {
- log.info("Executing Recovery")
- bluePrintRuntimeService.getBluePrintError().addError("${runtimeException.message}", getName())
+ this.addError("${runtimeException.message}")
}
}
diff --git a/tutorials/ApacheCNF/templates/cba/Scripts/kotlin/SimpleStatusCheck.kt b/tutorials/ApacheCNF/templates/cba/Scripts/kotlin/SimpleStatusCheck.kt
index c99dcd4f..c1f59d98 100644
--- a/tutorials/ApacheCNF/templates/cba/Scripts/kotlin/SimpleStatusCheck.kt
+++ b/tutorials/ApacheCNF/templates/cba/Scripts/kotlin/SimpleStatusCheck.kt
@@ -38,6 +38,7 @@ open class SimpleStatusCheck : AbstractScriptComponentFunction() {
log.info("SIMPLE STATUS CHECK - START")
val configValueSetup: ObjectNode = getDynamicProperties("config-deploy-setup") as ObjectNode
+ var checkCount: Int = getDynamicProperties("status-check-max-count").asInt()
val bluePrintPropertiesService: BluePrintPropertiesService =
this.functionDependencyInstanceAsType("bluePrintPropertiesService")
@@ -46,7 +47,6 @@ open class SimpleStatusCheck : AbstractScriptComponentFunction() {
val instanceApi = K8sPluginInstanceApi(k8sConfiguration)
- var checkCount: Int = 30 // in the future to be read in from the input
while (checkCount > 0) {
var continueCheck = false
configValueSetup.fields().forEach { it ->
@@ -75,7 +75,6 @@ open class SimpleStatusCheck : AbstractScriptComponentFunction() {
}
override suspend fun recoverNB(runtimeException: RuntimeException, executionRequest: ExecutionServiceInput) {
- log.info("Executing Recovery")
this.addError("${runtimeException.message}")
}
}