diff options
author | 2021-06-04 17:56:49 +0200 | |
---|---|---|
committer | 2021-06-10 18:23:54 +0200 | |
commit | da5e2b085b5eb072e318fcf239b4b79bb30c83b8 (patch) | |
tree | dcf3cde72c696b64a710fcd09c45e501834016b2 /openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org | |
parent | 3fdd800133ad5f07aadc90f9731cca28e96896d9 (diff) |
Add parameter for Zip Validation
Add a onboarding config parameter to enable or disable the Zip Validation
Issue-ID: SDC-3603
Signed-off-by: sebdet <sebastien.determe@intl.att.com>
Change-Id: I83f539caccd29799f613d4e0bb65c7d7e6b97b45
Diffstat (limited to 'openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org')
-rw-r--r-- | openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/onboarding/OnboardingPackageProcessor.java | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/onboarding/OnboardingPackageProcessor.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/onboarding/OnboardingPackageProcessor.java index 0446103491..e5b68cb917 100644 --- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/onboarding/OnboardingPackageProcessor.java +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/onboarding/OnboardingPackageProcessor.java @@ -49,6 +49,7 @@ import org.apache.commons.io.FilenameUtils; import org.openecomp.core.utilities.file.FileContentHandler; import org.openecomp.core.utilities.json.JsonUtil; import org.openecomp.core.utilities.orchestration.OnboardingTypesEnum; +import org.openecomp.sdc.common.CommonConfigurationManager; import org.openecomp.sdc.common.utils.CommonUtil; import org.openecomp.sdc.common.utils.SdcCommon; import org.openecomp.sdc.common.zip.exception.ZipException; @@ -145,19 +146,27 @@ public class OnboardingPackageProcessor { return new OnboardPackageInfo(onboardPackage, OnboardingTypesEnum.CSAR); } + private OnboardPackageInfo createOnboardPackageInfoForZip(String packageName, String packageExtension) { + return new OnboardPackageInfo( + new OnboardPackage(packageName, packageExtension, ByteBuffer.wrap(packageFileContent), + packageContent), OnboardingTypesEnum.ZIP); + } + private OnboardPackageInfo processOnapNativeZipPackage(String packageName, String packageExtension) { + if (CommonConfigurationManager.getInstance().getConfigValue("zipValidation", "ignoreManifest", false)) { + return createOnboardPackageInfoForZip(packageName, packageExtension); + } ManifestContent manifest = getManifest(); if (manifest != null) { List<String> errors = validateZipPackage(manifest); if (errors.isEmpty()) { - final OnboardPackage onboardPackage = new OnboardPackage(packageName, packageExtension, ByteBuffer.wrap(packageFileContent), - packageContent); - return new OnboardPackageInfo(onboardPackage, OnboardingTypesEnum.ZIP); + return createOnboardPackageInfoForZip(packageName, packageExtension); } else { errors.forEach(message -> reportError(ErrorLevel.ERROR, message)); } } else { - reportError(ErrorLevel.ERROR, COULD_NOT_READ_MANIFEST_FILE.formatMessage(SdcCommon.MANIFEST_NAME, packageFileName)); + reportError(ErrorLevel.ERROR, + COULD_NOT_READ_MANIFEST_FILE.formatMessage(SdcCommon.MANIFEST_NAME, packageFileName)); } return null; } |