diff --git a/src/agent/docker-rest-agent/requirements.txt b/src/agent/docker-rest-agent/requirements.txt index f38fe4169..fffe96a16 100644 --- a/src/agent/docker-rest-agent/requirements.txt +++ b/src/agent/docker-rest-agent/requirements.txt @@ -1,22 +1,4 @@ -aniso8601==8.0.0 -certifi==2020.6.20 -chardet==3.0.4 -click==7.1.2 docker==4.3.1 Flask==1.1.2 -Flask-RESTful==0.3.8 -idna==2.10 -itsdangerous==1.1.0 -Jinja2==2.11.2 -MarkupSafe==1.1.1 -pytz==2020.1 -requests==2.24.0 -six==1.15.0 -urllib3==1.25.11 -websocket-client==0.57.0 -Werkzeug==1.0.1 -gevent==20.9.0 -greenlet==0.4.17 gunicorn==20.0.4 -zope.event==4.5.0 -zope.interface==5.1.2 +gevent==1.4 diff --git a/src/api-engine/api/lib/agent/docker/handler.py b/src/api-engine/api/lib/agent/docker/handler.py index e2a3a1594..5e0cab208 100644 --- a/src/api-engine/api/lib/agent/docker/handler.py +++ b/src/api-engine/api/lib/agent/docker/handler.py @@ -2,7 +2,7 @@ # SPDX-License-Identifier: Apache-2.0 # import logging -from requests import put, get, post +from requests import get, post import json from api.lib.agent.base import AgentBase diff --git a/src/api-engine/api/lib/agent/handler.py b/src/api-engine/api/lib/agent/handler.py index 0d8c6ad41..a0fcc695e 100644 --- a/src/api-engine/api/lib/agent/handler.py +++ b/src/api-engine/api/lib/agent/handler.py @@ -2,7 +2,6 @@ # SPDX-License-Identifier: Apache-2.0 # import logging -import os from django.conf import settings diff --git a/src/api-engine/api/lib/agent/kubernetes/common.py b/src/api-engine/api/lib/agent/kubernetes/common.py index 55cee323e..543aac66b 100644 --- a/src/api-engine/api/lib/agent/kubernetes/common.py +++ b/src/api-engine/api/lib/agent/kubernetes/common.py @@ -1,5 +1,4 @@ import logging -import os from django.conf import settings from kubernetes import client, config diff --git a/src/api-engine/api/models.py b/src/api-engine/api/models.py index 62be9c297..602d25745 100644 --- a/src/api-engine/api/models.py +++ b/src/api-engine/api/models.py @@ -5,11 +5,9 @@ import shutil import tarfile from zipfile import ZipFile -from pathlib import Path from django.conf import settings from django.contrib.auth.models import AbstractUser -from django.contrib.postgres.fields import JSONField from django.core.exceptions import ValidationError from django.core.validators import MaxValueValidator, MinValueValidator from django.db import models @@ -19,7 +17,6 @@ from api.common.enums import ( HostStatus, - LogLevel, HostType, K8SCredentialType, separate_upper_class, @@ -262,7 +259,7 @@ class KubernetesConfig(models.Model): max_length=256, blank=True, ) - parameters = JSONField( + parameters = models.JSONField( help_text="Extra parameters for kubernetes", default=dict, null=True, @@ -379,7 +376,7 @@ class FabricCA(models.Model): default="adminpw", max_length=32, ) - hosts = JSONField( + hosts = models.JSONField( help_text="Hosts for ca", null=True, blank=True, default=list ) type = models.CharField( @@ -486,7 +483,7 @@ class Node(models.Model): % (FabricNodeType.names()), max_length=64, ) - urls = JSONField( + urls = models.JSONField( help_text="URL configurations for node", null=True, blank=True, @@ -739,7 +736,6 @@ class Channel(models.Model): organizations = models.ManyToManyField( to="Organization", help_text="the organization of the channel", - null=True, related_name="channels", # on_delete=models.SET_NULL ) @@ -752,7 +748,6 @@ class Channel(models.Model): orderers = models.ManyToManyField( to="Node", help_text="Orderer list in the channel", - null=True, ) # class ChainCode(models.Model): diff --git a/src/api-engine/api/routes/agent/serializers.py b/src/api-engine/api/routes/agent/serializers.py index 67f9add36..b538c4a84 100644 --- a/src/api-engine/api/routes/agent/serializers.py +++ b/src/api-engine/api/routes/agent/serializers.py @@ -4,16 +4,13 @@ import logging from django.core.validators import ( - URLValidator, RegexValidator, FileExtensionValidator, ) from rest_framework import serializers from api.common.enums import ( - NetworkStatus, LogLevel, - HostType, K8SCredentialType, separate_upper_class, ) diff --git a/src/api-engine/api/routes/chaincode/serializers.py b/src/api-engine/api/routes/chaincode/serializers.py index f747e22c8..3c31b81bc 100644 --- a/src/api-engine/api/routes/chaincode/serializers.py +++ b/src/api-engine/api/routes/chaincode/serializers.py @@ -1,3 +1,6 @@ +# +# SPDX-License-Identifier: Apache-2.0 +# from rest_framework import serializers from api.config import FABRIC_CHAINCODE_STORE diff --git a/src/api-engine/api/routes/chaincode/views.py b/src/api-engine/api/routes/chaincode/views.py index bb18d5d42..17ebb43cd 100644 --- a/src/api-engine/api/routes/chaincode/views.py +++ b/src/api-engine/api/routes/chaincode/views.py @@ -6,6 +6,9 @@ import zipfile from drf_yasg.utils import swagger_auto_schema +# +# SPDX-License-Identifier: Apache-2.0 +# from api.config import FABRIC_CHAINCODE_STORE from api.config import CELLO_HOME from api.models import ( diff --git a/src/api-engine/api/routes/channel/serializers.py b/src/api-engine/api/routes/channel/serializers.py index 67ae5f4ae..df133fa64 100644 --- a/src/api-engine/api/routes/channel/serializers.py +++ b/src/api-engine/api/routes/channel/serializers.py @@ -1,11 +1,13 @@ +# +# SPDX-License-Identifier: Apache-2.0 +# from rest_framework import serializers -from api.models import Channel, Organization +from api.models import Channel from api.common.serializers import ListResponseSerializer class ChannelCreateBody(serializers.Serializer): - #organization = serializers.UUIDField(help_text="ID of Organization") name = serializers.CharField(max_length=128, required=True) peers = serializers.ListField( child=serializers.UUIDField(help_text="ID of Peer Nodes") diff --git a/src/api-engine/api/routes/channel/views.py b/src/api-engine/api/routes/channel/views.py index dd6a76648..95840a35b 100644 --- a/src/api-engine/api/routes/channel/views.py +++ b/src/api-engine/api/routes/channel/views.py @@ -1,3 +1,6 @@ +# +# SPDX-License-Identifier: Apache-2.0 +# from rest_framework import viewsets, status from rest_framework.response import Response from rest_framework_jwt.authentication import JSONWebTokenAuthentication @@ -13,14 +16,12 @@ from api.auth import TokenAuth from api.lib.configtxgen import ConfigTX, ConfigTxGen from api.lib.peer.channel import Channel as PeerChannel -from api.lib.configtxlator.configtxlator import ConfigTxLator from api.exceptions import ( ResourceNotFound, ) from api.models import ( Channel, Node, - Port ) from api.routes.channel.serializers import ( ChannelCreateBody, diff --git a/src/api-engine/api/routes/general/serializers.py b/src/api-engine/api/routes/general/serializers.py index 9f0120c77..35636854c 100644 --- a/src/api-engine/api/routes/general/serializers.py +++ b/src/api-engine/api/routes/general/serializers.py @@ -1,8 +1,6 @@ # # SPDX-License-Identifier: Apache-2.0 # -from abc import ABC - from rest_framework import serializers diff --git a/src/api-engine/api/routes/general/views.py b/src/api-engine/api/routes/general/views.py index 01a490da6..c155b7bee 100644 --- a/src/api-engine/api/routes/general/views.py +++ b/src/api-engine/api/routes/general/views.py @@ -11,12 +11,11 @@ from api.models import UserProfile, Organization from api.routes.general.serializers import ( RegisterBody, - RegisterIDSerializer, RegisterResponse, - LoginBody, + ) from api.lib.pki import CryptoGen, CryptoConfig -from api.utils import zip_dir, zip_file +from api.utils import zip_dir from api.common import ok, err from api.config import CELLO_HOME from api.utils.jwt import jwt_response_payload_handler diff --git a/src/api-engine/api/routes/network/serializers.py b/src/api-engine/api/routes/network/serializers.py index 24b1174ac..4e90126f0 100644 --- a/src/api-engine/api/routes/network/serializers.py +++ b/src/api-engine/api/routes/network/serializers.py @@ -7,7 +7,6 @@ NetworkOperation, ChannelType, FabricNodeType, - NetworkCreateType, ) from api.models import Network diff --git a/src/api-engine/api/routes/network/views.py b/src/api-engine/api/routes/network/views.py index e46a1796e..4e32a002b 100644 --- a/src/api-engine/api/routes/network/views.py +++ b/src/api-engine/api/routes/network/views.py @@ -17,20 +17,15 @@ from api.routes.network.serializers import ( NetworkQuery, NetworkListResponse, - NetworkOperationBody, - ChannelBody, - ChannelID, - ChannelCreateBody, NetworkMemberResponse, NetworkCreateBody, NetworkIDSerializer, ) from api.utils.common import with_common_response -from api.common.enums import NodeStatus from api.lib.configtxgen import ConfigTX, ConfigTxGen from api.models import Network, Node, Port from api.config import CELLO_HOME -from api.utils import zip_dir, zip_file +from api.utils import zip_file from api.auth import TokenAuth from api.lib.agent import AgentHandler from api.common import ok, err diff --git a/src/api-engine/api/routes/node/serializers.py b/src/api-engine/api/routes/node/serializers.py index c924a8332..94e67a195 100644 --- a/src/api-engine/api/routes/node/serializers.py +++ b/src/api-engine/api/routes/node/serializers.py @@ -3,27 +3,20 @@ # import logging -from django.core.validators import FileExtensionValidator from rest_framework import serializers from api.common.enums import ( Operation, - NetworkType, - FabricNodeType, - FabricVersions, - HostType, ) from api.common.serializers import PageQuerySerializer from api.models import ( Node, Port, FabricCA, - validate_file, NodeUser, FabricPeer, PeerCa, PeerCaUser, ) -from api.utils.common import to_form_paras LOG = logging.getLogger(__name__) diff --git a/src/api-engine/api/routes/node/views.py b/src/api-engine/api/routes/node/views.py index b29312f4d..d49f84682 100644 --- a/src/api-engine/api/routes/node/views.py +++ b/src/api-engine/api/routes/node/views.py @@ -8,28 +8,20 @@ import threading from django.core.exceptions import ObjectDoesNotExist -from django.core.exceptions import PermissionDenied from django.core.paginator import Paginator -from django.db.models import Count, F -from django.urls import reverse from drf_yasg.utils import swagger_auto_schema from rest_framework import viewsets, status from rest_framework.decorators import action -from rest_framework.permissions import IsAuthenticated from rest_framework.response import Response from rest_framework_jwt.authentication import JSONWebTokenAuthentication -from api.auth import IsOperatorAuthenticated -from api.common.enums import NodeStatus, AgentOperation, Operation +from api.common.enums import AgentOperation from api.exceptions import CustomError, NoResource, ResourceExists, ResourceInUse from api.exceptions import ResourceNotFound from api.models import ( - Agent, Node, - Organization, Port, FabricCA, - FabricNodeType, FabricCAServerType, NodeUser, FabricPeer, @@ -41,7 +33,6 @@ NodeQuery, NodeCreateBody, NodeIDSerializer, - NodeCIDSerializer, NodeListSerializer, NodeUpdateBody, # NodeFileCreateSerializer, @@ -54,7 +45,7 @@ ) from api.tasks import operate_node from api.utils.common import with_common_response -from api.auth import CustomAuthenticate, TokenAuth +from api.auth import TokenAuth from api.lib.pki import CryptoGen, CryptoConfig from api.utils import zip_dir, zip_file from api.config import ( diff --git a/src/api-engine/api/routes/organization/views.py b/src/api-engine/api/routes/organization/views.py index 6d2a2874d..7a72a5d82 100644 --- a/src/api-engine/api/routes/organization/views.py +++ b/src/api-engine/api/routes/organization/views.py @@ -8,28 +8,16 @@ from rest_framework import viewsets, status from rest_framework.decorators import action -from rest_framework.permissions import IsAuthenticated from rest_framework.response import Response from drf_yasg.utils import swagger_auto_schema from django.core.exceptions import ObjectDoesNotExist from django.core.paginator import Paginator -from rest_framework_jwt.authentication import JSONWebTokenAuthentication -from api.auth import IsOperatorAuthenticated from api.utils.common import with_common_response from api.exceptions import ResourceExists, ResourceNotFound, ResourceInUse from api.models import ( - Agent, Node, Organization, - Port, - FabricCA, - FabricNodeType, - FabricCAServerType, - NodeUser, - FabricPeer, - PeerCa, - PeerCaUser, ) from api.routes.organization.serializers import ( OrganizationQuery, @@ -40,15 +28,17 @@ OrganizationUpdateBody, ) from api.routes.user.serializers import UserIDSerializer -from api.models import UserProfile, Organization, Network +from api.models import UserProfile, Organization from api.routes.user.serializers import UserListSerializer, UserQuerySerializer from api.lib.pki import CryptoGen, CryptoConfig from api.utils import zip_dir, zip_file from api.config import CELLO_HOME -from api.auth import TokenAuth from api.utils.node_config import NodeConfig -from api.common import ok, err +from api.common import ( + ok, + #err +) LOG = logging.getLogger(__name__) diff --git a/src/api-engine/api/routes/user/views.py b/src/api-engine/api/routes/user/views.py index 59fbe2319..e69b37357 100644 --- a/src/api-engine/api/routes/user/views.py +++ b/src/api-engine/api/routes/user/views.py @@ -9,11 +9,8 @@ from drf_yasg.utils import swagger_auto_schema from rest_framework import viewsets, status from rest_framework.decorators import action -from rest_framework.permissions import IsAuthenticated from rest_framework.response import Response -from rest_framework_jwt.authentication import JSONWebTokenAuthentication -from api.auth import IsAdminAuthenticated, IsOperatorAuthenticated from api.exceptions import ResourceExists, CustomError from api.models import UserProfile from api.routes.user.serializers import ( @@ -22,9 +19,7 @@ UserQuerySerializer, UserListSerializer, ) -from api.utils.common import any_of from api.utils.common import with_common_response -from api.auth import TokenAuth LOG = logging.getLogger(__name__) diff --git a/src/api-engine/requirements.txt b/src/api-engine/requirements.txt index e11353624..246127be2 100644 --- a/src/api-engine/requirements.txt +++ b/src/api-engine/requirements.txt @@ -1,20 +1,17 @@ -amqp==2.6.1 asgiref==3.3.1 attrs==20.3.0 -billiard==3.5.0.5 cachetools==4.1.1 -celery==4.2.1 +celery==5.2.6 certifi==2020.11.8 chardet==3.0.4 -click==7.1.2 coreapi==2.3.3 coreschema==0.0.4 defusedxml==0.6.0 -Django==3.1.13 +Django==3.1.14 django-allauth==0.41.0 django-cors-headers==3.5.0 django-extensions==2.2.9 -django-filter==2.0.0 +django-filter==2.4.0 django-rest-auth==0.9.5 djangorestframework==3.11.2 djangorestframework-jwt==1.11.0 @@ -29,7 +26,6 @@ itypes==1.2.0 Jinja2==2.11.3 jsonpointer==2.0 jsonschema==3.2.0 -kombu==4.6.11 kubernetes==11.0.0 MarkupSafe==1.1.1 oauthlib==3.1.0 @@ -44,7 +40,6 @@ pyparsing==2.4.7 pyrsistent==0.17.3 python-dateutil==2.8.1 python3-openid==3.2.0 -pytz==2020.4 PyYAML==5.4 redis==3.4.1 requests==2.25.0 @@ -53,7 +48,7 @@ rfc3987==1.3.8 rsa==4.7 ruamel.yaml==0.16.12 ruamel.yaml.clib==0.2.2 -six==1.15.0 +six==1.16.0 sqlparse==0.4.2 strict-rfc3339==0.7 swagger-spec-validator==2.5.0 @@ -61,6 +56,5 @@ uritemplate==3.0.1 urllib3==1.26.5 uWSGI==2.0.18 validate-email==1.3 -vine==1.3.0 watchdog==0.10.2 -websocket-client==0.57.0 +websocket-client==0.57.0 \ No newline at end of file