summaryrefslogtreecommitdiffstats
path: root/ms/blueprintsprocessor/functions/k8s-profile-upload/src/main
diff options
context:
space:
mode:
authorLukasz Rajewski <lukasz.rajewski@orange.com>2020-10-09 23:19:07 +0200
committerLukasz Rajewski <lukasz.rajewski@orange.com>2020-10-09 23:19:50 +0200
commite7396afde23c4d335a097fa02bcae5f47a4ca6ed (patch)
treefca4e3938ba6b709fc860cd5b7d7404c458b4678 /ms/blueprintsprocessor/functions/k8s-profile-upload/src/main
parentcef859c192e84d61f2e98afc6f208772c1ac4699 (diff)
Fixed k8s profile upload for source with tar.gz file
Fixed k8s profile upload for source with tar.gz file Change was tested with CBA https://gerrit.onap.org/r/c/demo/+/113732 Change-Id: I08aa834cc4fedaf77b4c660ec16dea930dade588 Issue-ID: CCSDK-2899 Signed-off-by: Lukasz Rajewski <lukasz.rajewski@orange.com>
Diffstat (limited to 'ms/blueprintsprocessor/functions/k8s-profile-upload/src/main')
-rw-r--r--ms/blueprintsprocessor/functions/k8s-profile-upload/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/k8s/profile/upload/K8sProfileUploadComponent.kt21
1 files changed, 9 insertions, 12 deletions
diff --git a/ms/blueprintsprocessor/functions/k8s-profile-upload/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/k8s/profile/upload/K8sProfileUploadComponent.kt b/ms/blueprintsprocessor/functions/k8s-profile-upload/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/k8s/profile/upload/K8sProfileUploadComponent.kt
index 6b575a60a..76b7fae71 100644
--- a/ms/blueprintsprocessor/functions/k8s-profile-upload/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/k8s/profile/upload/K8sProfileUploadComponent.kt
+++ b/ms/blueprintsprocessor/functions/k8s-profile-upload/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/k8s/profile/upload/K8sProfileUploadComponent.kt
@@ -198,16 +198,13 @@ open class K8sProfileUploadComponent(
private suspend fun prepareProfileFile(k8sRbProfileName: String, ks8ProfileSource: String, ks8ProfileLocation: String): Path {
val bluePrintContext = bluePrintRuntimeService.bluePrintContext()
val bluePrintBasePath: String = bluePrintContext.rootPath
- val profileSourceFileFolderPath: String = bluePrintBasePath.plus(File.separator)
- .plus(ks8ProfileLocation)
- val profileFilePathTarGz: String = profileSourceFileFolderPath.plus(".tar.gz")
- val profileFilePathTgz: String = profileSourceFileFolderPath.plus(".tgz")
+ val profileSourceFileFolderPath: Path = Paths.get(
+ bluePrintBasePath.plus(File.separator).plus(ks8ProfileLocation)
+ )
- if (Paths.get(profileFilePathTarGz).toFile().exists())
- return Paths.get(profileFilePathTarGz)
- else if (Paths.get(profileFilePathTgz).toFile().exists())
- return Paths.get(profileFilePathTgz)
- else if (Paths.get(profileSourceFileFolderPath).toFile().exists()) {
+ if (profileSourceFileFolderPath.toFile().exists() && !profileSourceFileFolderPath.toFile().isDirectory)
+ return profileSourceFileFolderPath
+ else if (profileSourceFileFolderPath.toFile().exists()) {
log.info("Profile building started from source $ks8ProfileSource")
val properties: MutableMap<String, Any> = mutableMapOf()
properties[ResourceResolutionConstants.RESOURCE_RESOLUTION_INPUT_STORE_RESULT] = false
@@ -227,12 +224,12 @@ open class K8sProfileUploadComponent(
try {
val manifestFiles: ArrayList<File>? = readManifestFiles(
- Paths.get(profileSourceFileFolderPath).toFile(),
+ profileSourceFileFolderPath.toFile(),
tempProfilePath
)
if (manifestFiles != null) {
templateLocation(
- Paths.get(profileSourceFileFolderPath).toFile(), resolutionResult.second,
+ profileSourceFileFolderPath.toFile(), resolutionResult.second,
tempProfilePath, manifestFiles
)
} else
@@ -258,7 +255,7 @@ open class K8sProfileUploadComponent(
throw t
}
} else
- throw BluePrintProcessorException("Profile source $ks8ProfileSource is missing in CBA folder")
+ throw BluePrintProcessorException("Profile source $ks8ProfileLocation is missing in CBA folder")
}
private fun readManifestFiles(profileSource: File, destinationFolder: File): ArrayList<File>? {