aboutsummaryrefslogtreecommitdiffstats
path: root/vnfsdk_pkgtools/packager/csar.py
diff options
context:
space:
mode:
authorLianhao Lu <lianhao.lu@intel.com>2018-08-29 13:55:41 +0800
committerLianhao Lu <lianhao.lu@intel.com>2018-08-29 13:55:41 +0800
commit7db9cd91cd0b25000fca4c3ffb5c59cc413ad3f6 (patch)
tree6a8c9a76aa82f17d7c76be2c1da470b4c8e23683 /vnfsdk_pkgtools/packager/csar.py
parent03257fcd7885f7a8c47e2f8f34204097201f5b89 (diff)
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 <lianhao.lu@intel.com>
Diffstat (limited to 'vnfsdk_pkgtools/packager/csar.py')
-rw-r--r--vnfsdk_pkgtools/packager/csar.py6
1 files changed, 3 insertions, 3 deletions
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: