Exemplo n.º 1
0
    def get_asset_instance(server_id):
        response = BaseResponse()
        try:
            response.data = models.Applications.objects.filter(id=server_id).first()
            # 返回docker宿主机
            response.asset_data = CMDB_MODELS.Asset.objects.filter(device_type_id=2)

        except Exception as e:
            print(Exception, e)
            response.status = False
            response.message = str(e)
        return response
Exemplo n.º 2
0
    def server_config(server_id):

        response = BaseResponse()
        try:
            response.data = models.Applications.objects.filter(id=server_id).first()
            response.asset_data = CMDB_MODELS.Asset.objects.all()
            response.urlmaps_data = models.UrlConfigHandler.objects.filter(group_id__app_id=server_id).first()
        except Exception as e:
            print(Exception, e)
            response.status = False
            response.message = str(e)
        return response
Exemplo n.º 3
0
    def get_asset_instance(server_id):
        response = BaseResponse()
        try:
            response.data = models.Applications.objects.filter(id=server_id).first()
            # 获取project的business,再通过business查找cmdb中对应的资产信息,此处用于绑定实例时,过滤业务线中的资产数据
            response.asset_data = CMDB_MODELS.Asset.objects.filter(
                business_unit__projectinfo__applications__id=server_id)

        except Exception as e:
            print(Exception, e)
            response.status = False
            response.message = str(e)
        return response
Exemplo n.º 4
0
    def get_asset_instance(server_id):
        response = BaseResponse()
        try:
            response.data = models.Applications.objects.filter(
                id=server_id).first()
            # 获取project的business,再通过business查找cmdb中对应的资产信息,此处用于绑定实例时,过滤业务线中的资产数据
            response.asset_data = CMDB_MODELS.Asset.objects.filter(
                business_unit__projectinfo__applications__id=server_id)

        except Exception as e:
            print(Exception, e)
            response.status = False
            response.message = str(e)
        return response