import com.fasterxml.jackson.databind.node.ArrayNode
import com.fasterxml.jackson.databind.node.ObjectNode
import org.apache.commons.io.FileUtils
-import org.onap.ccsdk.cds.blueprintsprocessor.core.BluePrintPropertiesService
+import org.onap.ccsdk.cds.blueprintsprocessor.core.BlueprintPropertiesService
import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.ExecutionServiceInput
import org.onap.ccsdk.cds.controllerblueprints.resource.dict.ResourceAssignment
import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.ResourceResolutionConstants
import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.ResourceResolutionService
import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.AbstractComponentFunction
-import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants
-import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintProcessorException
+import org.onap.ccsdk.cds.controllerblueprints.core.BlueprintConstants
+import org.onap.ccsdk.cds.controllerblueprints.core.BlueprintProcessorException
import org.onap.ccsdk.cds.controllerblueprints.core.asJsonNode
import org.onap.ccsdk.cds.controllerblueprints.core.data.ArtifactDefinition
import org.onap.ccsdk.cds.controllerblueprints.core.returnNullIfMissing
-import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintVelocityTemplateService
+import org.onap.ccsdk.cds.controllerblueprints.core.service.BlueprintVelocityTemplateService
import org.onap.ccsdk.cds.controllerblueprints.core.utils.ArchiveType
-import org.onap.ccsdk.cds.controllerblueprints.core.utils.BluePrintArchiveUtils
+import org.onap.ccsdk.cds.controllerblueprints.core.utils.BlueprintArchiveUtils
import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils
import org.slf4j.LoggerFactory
import org.springframework.beans.factory.config.ConfigurableBeanFactory
@Component("component-k8s-profile-upload")
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
open class K8sProfileUploadComponent(
- private var bluePrintPropertiesService: BluePrintPropertiesService,
+ private var bluePrintPropertiesService: BlueprintPropertiesService,
private val resourceResolutionService: ResourceResolutionService
) :
val profileNamespace: String? = prefixInputParamsMap[INPUT_K8S_PROFILE_NAMESPACE]?.returnNullIfMissing()?.asText()
var profileSource: String? = prefixInputParamsMap[INPUT_K8S_PROFILE_SOURCE]?.returnNullIfMissing()?.asText()
if (profileNamespace == null)
- throw BluePrintProcessorException("Profile $profileName namespace is missing")
+ throw BlueprintProcessorException("Profile $profileName namespace is missing")
if (profileSource == null) {
profileSource = profileName
log.info("Profile name used instead of profile source")
}
val bluePrintContext = bluePrintRuntimeService.bluePrintContext()
val artifact: ArtifactDefinition = bluePrintContext.nodeTemplateArtifact(nodeTemplateName, profileSource)
- if (artifact.type != BluePrintConstants.MODEL_TYPE_ARTIFACT_K8S_PROFILE)
- throw BluePrintProcessorException(
+ if (artifact.type != BlueprintConstants.MODEL_TYPE_ARTIFACT_K8S_PROFILE)
+ throw BlueprintProcessorException(
"Unexpected profile artifact type for profile source " +
"$profileSource. Expecting: $artifact.type"
)
}
override suspend fun recoverNB(runtimeException: RuntimeException, executionRequest: ExecutionServiceInput) {
- bluePrintRuntimeService.getBluePrintError().addError(runtimeException.message!!)
+ bluePrintRuntimeService.getBlueprintError().addError(runtimeException.message!!)
}
private fun getTemplatePrefixList(node: JsonNode?): ArrayList<String> {
tempProfilePath, manifestFiles
)
} else
- throw BluePrintProcessorException("Manifest file is missing")
+ throw BlueprintProcessorException("Manifest file is missing")
// Preparation of the final profile content
val finalProfileFilePath = Paths.get(
tempMainPath.toString().plus(File.separator).plus(
"$k8sRbProfileName.tar.gz"
)
)
- if (!BluePrintArchiveUtils.compress(
+ if (!BlueprintArchiveUtils.compress(
tempProfilePath, finalProfileFilePath.toFile(),
ArchiveType.TarGz
)
) {
- throw BluePrintProcessorException("Profile compression has failed")
+ throw BlueprintProcessorException("Profile compression has failed")
}
FileUtils.deleteDirectory(tempProfilePath)
throw t
}
} else
- throw BluePrintProcessorException("Profile source $ks8ProfileLocation is missing in CBA folder")
+ throw BlueprintProcessorException("Profile source $ks8ProfileLocation is missing in CBA folder")
}
private fun readManifestFiles(profileSource: File, destinationFolder: File): ArrayList<File>? {
if (!isFileInTheManifestFiles(finalFile, manifestFiles))
return
val fileContent = templatedFile.bufferedReader().readText()
- val finalFileContent = BluePrintVelocityTemplateService.generateContent(
+ val finalFileContent = BlueprintVelocityTemplateService.generateContent(
fileContent,
params, true
)