- Upload CBA sometimes failed because Property files were left opened.
- Default value were ignored on datatype elements.
- Various erroneous error messages
- Fixed job template lookup by name encoding when name contains blanks.
Issue-ID: CCSDK-1357
Signed-off-by: Serge Simard <serge@agilitae.com>
Change-Id: If9d4b0339d647e6c99121f5464a1b6da787761a0
Signed-off-by: Serge Simard <serge@agilitae.com>
import com.fasterxml.jackson.databind.JsonNode
import com.fasterxml.jackson.databind.ObjectMapper
import com.fasterxml.jackson.databind.node.ObjectNode
+import java.net.URI
import java.net.URLEncoder
import java.util.NoSuchElementException
import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.*
private fun lookupJobTemplateIDByName(awxClient : BlueprintWebClientService, job_template_name: String?): String {
val mapper = ObjectMapper()
+ val encodedJTName = URI(null,null,
+ "/api/v2/job_templates/${job_template_name}/",
+ null,null).rawPath
+
// Get Job Template details by name
- var response = awxClient.exchangeResource(GET, "/api/v2/job_templates/${job_template_name}/", "")
+ var response = awxClient.exchangeResource(GET, encodedJTName,"")
val jtDetails: JsonNode = mapper.readTree(response.body)
return jtDetails.at("/id").asText()
}
override suspend fun recoverNB(runtimeException: RuntimeException, resourceAssignment: ResourceAssignment) {
raRuntimeService.getBluePrintError()
- .addError("Failed in ComponentNetconfExecutor : ${runtimeException.message}")
+ .addError("Failed in CapabilityResourceResolutionProcessor : ${runtimeException.message}")
}
suspend fun scriptInstance(scriptType: String, scriptClassReference: String, instanceDependencies: List<String>)
try {
process(resourceAssignment)
} catch (runtimeException: RuntimeException) {
- log.error("failed in ${getName()} : ${runtimeException.message}", runtimeException)
+ log.error("failed in ResourceAssignmentProcessor : ${runtimeException.message}", runtimeException)
recover(runtimeException, resourceAssignment)
}
}
try {
if (resourceProp.type.isNotEmpty()) {
logger.info("Setting Resource Value ($value) for Resource Name " +
- "(${resourceAssignment.dictionaryName}) of type (${resourceProp.type})")
+ "(${resourceAssignment.name}) of type (${resourceProp.type})")
setResourceValue(resourceAssignment, raRuntimeService, value)
resourceAssignment.updatedDate = Date()
resourceAssignment.updatedBy = BluePrintConstants.USER_SYSTEM
workflowDynamicInputs?.let {
bluePrintContext.dataTypeByName("dt-$dynamicInputPropertiesName")?.properties?.forEach { propertyName, property ->
- val valueNode: JsonNode = workflowDynamicInputs.at(BluePrintConstants.PATH_DIVIDER + propertyName)
+ val valueNode: JsonNode = workflowDynamicInputs.at(BluePrintConstants.PATH_DIVIDER + propertyName).returnNullIfMissing()
+ ?: property.defaultValue
?: NullNode.getInstance()
setInputValue(propertyName, property, valueNode)
envDir.listFiles()
.filter { it.name.endsWith(".properties") }
.forEach {
- properties.load(it.inputStream())
+ val istream = it.inputStream()
+ properties.load(istream)
+ istream.close()
}
}
return properties