Skip to content

Commit

Permalink
feature: 提供 Agent 包管理后台接口 (closed TencentBlueKing#1683)
Browse files Browse the repository at this point in the history
  • Loading branch information
ping15 committed Nov 20, 2023
1 parent 25308d6 commit ec1e64c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 4 additions & 0 deletions apps/node_man/handlers/meta.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
from apps.node_man.handlers.cmdb import CmdbHandler
from apps.node_man.handlers.install_channel import InstallChannelHandler
from apps.node_man.models import GsePackages
from apps.node_man.permissions.package_manage import PackageManagePermission
from apps.node_man.serializers.package_manage import FilterConditionPackageSerializer
from apps.utils import APIModel

Expand Down Expand Up @@ -473,6 +474,9 @@ def fetch_os_type_children(os_types: Tuple = constants.OsType):

@staticmethod
def fetch_agent_pkg_manager_children():
if not PackageManagePermission().has_permission(None, None):
return {"message": "该用户不是管理员"}

version_set, tag_name_description_map, creator_set, is_ready_set = set(), dict(), set(), set()
gse_packages = FilterConditionPackageSerializer(GsePackages.objects.all(), many=True).data
for gse_package in gse_packages:
Expand Down
4 changes: 2 additions & 2 deletions apps/node_man/tests/test_views/test_package_manage_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
)
from apps.core.tag.models import Tag
from apps.node_man.handlers.meta import MetaHandler
from apps.node_man.models import GsePackages, GsePackageDesc
from apps.node_man.models import GsePackageDesc, GsePackages
from apps.node_man.tests.utils import create_gse_package


Expand All @@ -31,7 +31,7 @@ def clear_agent_data(cls):

def test_list(self):
# 和之前的builder.make加起来100
create_gse_package(99)
create_gse_package(99, start_id=1000)

result = self.client.get(path="/api/agent/package/")
self.assertEqual(result["result"], True)
Expand Down

0 comments on commit ec1e64c

Please sign in to comment.