aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfengyuanxing <feng.yuanxing@zte.com.cn>2018-01-30 15:06:28 +0800
committerfengyuanxing <feng.yuanxing@zte.com.cn>2018-01-30 15:07:56 +0800
commitc1ea84d3ff8853a6cd99a347d4fb4de47b1f1028 (patch)
tree7fb29887fdae68345c8c03bdcb0a4b417517a2a7
parentd3be43e3fd7102076350ea23dda27f0228c147dc (diff)
Modify code of distributing ns package
Change-Id: Ib5660be880ebfe3bf244665dc1f346a5b3219458 Issue-ID: VFC-685 Signed-off-by: fengyuanxing <feng.yuanxing@zte.com.cn>
-rw-r--r--catalog/packages/views.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/catalog/packages/views.py b/catalog/packages/views.py
index f9e9cabf..cc8b4a3c 100644
--- a/catalog/packages/views.py
+++ b/catalog/packages/views.py
@@ -23,6 +23,7 @@ from catalog.packages import nf_package
from catalog.packages import ns_package
from catalog.serializers import NsPackagesSerializer
from catalog.serializers import NfPackagesSerializer
+from catalog.serializers import NsPackageDistributeRequestSerializer
from catalog.serializers import NfPackageDistributeRequestSerializer
from catalog.serializers import NfPackageSerializer
from catalog.serializers import ParseModelRequestSerializer
@@ -39,7 +40,7 @@ logger = logging.getLogger(__name__)
@swagger_auto_schema(
method='POST',
operation_description="On distribute NS package",
- request_body=no_body,
+ request_body=NsPackageDistributeRequestSerializer,
responses={
status.HTTP_202_ACCEPTED: openapi.Response(
'return code',
@@ -72,6 +73,11 @@ def nspackages_rc(request, *args, **kwargs):
return validation_error
elif request.method == 'POST':
# Distributes the package accroding to the given csarId
+ request_serializer = NsPackageDistributeRequestSerializer(data=request.data)
+ validation_error = handleValidatonError(request_serializer, True)
+ if validation_error:
+ return validation_error
+
csar_id = ignore_case_get(request.data, "csarId")
logger.debug("csar_id is %s", csar_id)
ret = ns_package.ns_on_distribute(csar_id)