mirror of https://github.com/veops/cmdb.git
fix: ipam
This commit is contained in:
parent
ae8062fd04
commit
21fa7d9d5e
|
@ -114,7 +114,8 @@ class CIManager(object):
|
|||
ci_type = CITypeCache.get(ci.type_id)
|
||||
res["ci_type"] = ci_type.name
|
||||
|
||||
res.update(cls.get_cis_by_ids([str(ci_id)], fields=fields, ret_key=ret_key))
|
||||
ci_list = cls.get_cis_by_ids([str(ci_id)], fields=fields, ret_key=ret_key)
|
||||
ci_list and res.update(ci_list[0])
|
||||
|
||||
res['_type'] = ci_type.id
|
||||
res['_id'] = ci_id
|
||||
|
|
|
@ -24,6 +24,7 @@ from api.lib.cmdb.const import ConstraintEnum
|
|||
from api.lib.cmdb.const import PermEnum
|
||||
from api.lib.cmdb.const import ResourceTypeEnum
|
||||
from api.lib.cmdb.const import RoleEnum
|
||||
from api.lib.cmdb.const import SysComputedAttributes
|
||||
from api.lib.cmdb.const import ValueTypeEnum
|
||||
from api.lib.cmdb.history import CITypeHistoryManager
|
||||
from api.lib.cmdb.perms import CIFilterPermsCRUD
|
||||
|
@ -188,7 +189,7 @@ class CITypeManager(object):
|
|||
|
||||
ci_type = cls.check_is_existed(type_id)
|
||||
|
||||
if ci_type.name in BuiltinModelEnum.all() and kwargs.get('name') != ci_type.name:
|
||||
if ci_type.name in BuiltinModelEnum.all() and kwargs.get('name', ci_type.name) != ci_type.name:
|
||||
return abort(400, ErrFormat.builtin_type_cannot_update_name)
|
||||
|
||||
cls._validate_unique(type_id=type_id, name=kwargs.get('name'))
|
||||
|
|
|
@ -9,7 +9,7 @@ from api.lib.cmdb.cache import AttributeCache
|
|||
from api.lib.cmdb.cache import CITypeCache
|
||||
from api.lib.cmdb.ci import CIManager
|
||||
from api.lib.cmdb.ci import CIRelationManager
|
||||
from api.lib.cmdb.const import BuiltinModelEnum
|
||||
from api.lib.cmdb.const import BuiltinModelEnum, BUILTIN_ATTRIBUTES
|
||||
from api.lib.cmdb.ipam.const import OperateTypeEnum
|
||||
from api.lib.cmdb.ipam.const import SubnetBuiltinAttributes
|
||||
from api.lib.cmdb.ipam.history import OperateHistoryManager
|
||||
|
@ -111,7 +111,7 @@ class SubnetManager(object):
|
|||
response, _, _, _, _, _ = SearchFromDB("_type:({})".format(";".join(map(str, ci_types))),
|
||||
ci_ids=list(ids),
|
||||
count=1000000,
|
||||
fl=fl,
|
||||
fl=list(set(fl + [SubnetBuiltinAttributes.CIDR])),
|
||||
parent_node_perm_passed=True).search()
|
||||
id2ci = {i['_id']: i for i in response}
|
||||
|
||||
|
|
|
@ -21,6 +21,7 @@ from api.lib.cmdb.const import ConstraintEnum
|
|||
from api.lib.cmdb.const import PermEnum
|
||||
from api.lib.cmdb.const import ResourceTypeEnum
|
||||
from api.lib.cmdb.const import RoleEnum
|
||||
from api.lib.cmdb.const import SysComputedAttributes
|
||||
from api.lib.cmdb.perms import CIFilterPermsCRUD
|
||||
from api.lib.cmdb.resp_format import ErrFormat
|
||||
from api.lib.exception import AbortException
|
||||
|
@ -48,7 +49,7 @@ class PreferenceManager(object):
|
|||
type2group = {}
|
||||
for i in db.session.query(CITypeGroupItem, CITypeGroup).join(
|
||||
CITypeGroup, CITypeGroup.id == CITypeGroupItem.group_id).filter(
|
||||
CITypeGroup.deleted.is_(False)).filter(CITypeGroupItem.deleted.is_(False)):
|
||||
CITypeGroup.deleted.is_(False)).filter(CITypeGroupItem.deleted.is_(False)):
|
||||
type2group[i.CITypeGroupItem.type_id] = i.CITypeGroup.to_dict()
|
||||
|
||||
types = db.session.query(PreferenceShowAttributes.type_id).filter(
|
||||
|
|
Loading…
Reference in New Issue