From 7db9cd91cd0b25000fca4c3ffb5c59cc413ad3f6 Mon Sep 17 00:00:00 2001 From: Lianhao Lu Date: Wed, 29 Aug 2018 13:55:41 +0800 Subject: Added more logic about cmd param validation Shouldn't allow the user to set digest or certificate if manifest is not set. Change-Id: Iccb9f038106d52039f75ce80af1cce3858d1fba5 Issue-ID: VNFSDK-311 Signed-off-by: Lianhao Lu --- vnfsdk_pkgtools/packager/csar.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'vnfsdk_pkgtools/packager/csar.py') diff --git a/vnfsdk_pkgtools/packager/csar.py b/vnfsdk_pkgtools/packager/csar.py index 8b1eb34..af84974 100644 --- a/vnfsdk_pkgtools/packager/csar.py +++ b/vnfsdk_pkgtools/packager/csar.py @@ -98,6 +98,8 @@ def write(source, entry, destination, args): metadata[META_ENTRY_MANIFEST_FILE_KEY] = args.manifest manifest_file = manifest.Manifest(source, args.manifest) manifest_file_full_path = os.path.join(source, args.manifest) + elif args.certificate or args.digest: + raise ValueError("Must specify manifest file if certificate or digest is specified") else: manifest_file = None manifest_file_full_path = None @@ -117,7 +119,7 @@ def write(source, entry, destination, args): check_dir=False) metadata[META_ENTRY_CERT_FILE_KEY] = args.certificate if not args.privkey: - raise RuntimeError('Need private key file for signing') + raise ValueError('Need private key file for signing') check_file_dir(root='', entry=args.privkey, msg='Please specify a valid private key file.', @@ -334,8 +336,6 @@ class _CSARReader(object): no_verify_cert) os.unlink(tmp_manifest) - - def _download(self, url, target): response = requests.get(url, stream=True) if response.status_code != 200: -- cgit 1.2.3-korg