diff options
author | Lukasz Rajewski <lukasz.rajewski@orange.com> | 2020-10-09 23:19:07 +0200 |
---|---|---|
committer | Lukasz Rajewski <lukasz.rajewski@orange.com> | 2020-10-12 08:22:24 +0000 |
commit | 92437f7bc06c0f0874b751409d673d963468c610 (patch) | |
tree | ffa80463ecf9f95daf870e1da04800649a5f04ea | |
parent | 0ba2e434bf59ac655a87ce89e79b7f9a159dd004 (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>
(cherry picked from commit e7396afde23c4d335a097fa02bcae5f47a4ca6ed)
-rw-r--r-- | ms/blueprintsprocessor/functions/k8s-profile-upload/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/k8s/profile/upload/K8sProfileUploadComponent.kt | 21 |
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>? { |