mirror of
https://github.com/veops/cmdb.git
synced 2025-08-07 21:18:13 +08:00
docker-compose is ok
This commit is contained in:
@@ -41,6 +41,15 @@ from api.models.cmdb import PreferenceRelationView
|
||||
def cmdb_init_cache():
|
||||
db.session.remove()
|
||||
|
||||
ci_relations = CIRelation.get_by(to_dict=False)
|
||||
relations = dict()
|
||||
for cr in ci_relations:
|
||||
relations.setdefault(cr.first_ci_id, {}).update({cr.second_ci_id: cr.second_ci.type_id})
|
||||
for i in relations:
|
||||
relations[i] = json.dumps(relations[i])
|
||||
if relations:
|
||||
rd.create_or_update(relations, REDIS_PREFIX_CI_RELATION)
|
||||
|
||||
if current_app.config.get("USE_ES"):
|
||||
from api.extensions import es
|
||||
from api.models.cmdb import Attribute
|
||||
@@ -83,15 +92,6 @@ def cmdb_init_cache():
|
||||
else:
|
||||
rd.create_or_update({ci.id: json.dumps(ci_dict)}, REDIS_PREFIX_CI)
|
||||
|
||||
ci_relations = CIRelation.get_by(to_dict=False)
|
||||
relations = dict()
|
||||
for cr in ci_relations:
|
||||
relations.setdefault(cr.first_ci_id, {}).update({cr.second_ci_id: cr.second_ci.type_id})
|
||||
for i in relations:
|
||||
relations[i] = json.dumps(relations[i])
|
||||
if relations:
|
||||
rd.create_or_update(relations, REDIS_PREFIX_CI_RELATION)
|
||||
|
||||
db.session.remove()
|
||||
|
||||
|
||||
|
@@ -95,7 +95,7 @@ class Search(object):
|
||||
for _v in new_v:
|
||||
ci_type = CITypeCache.get(_v)
|
||||
|
||||
if len(new_v) == 1 and not self.sort and ci_type.default_order_attr:
|
||||
if len(new_v) == 1 and not self.sort and ci_type and ci_type.default_order_attr:
|
||||
self.sort = ci_type.default_order_attr
|
||||
|
||||
if ci_type is not None:
|
||||
|
@@ -41,7 +41,7 @@ class ACLManager(object):
|
||||
def get_all_roles(self):
|
||||
numfound, roles = RoleCRUD.search(
|
||||
None, self.app_name, 1, 999999, True, True, False)
|
||||
return roles
|
||||
return [i.to_dict() for i in roles]
|
||||
|
||||
def remove_user_from_role(self, user_rid, payload):
|
||||
app_id = self.app_name
|
||||
|
@@ -444,7 +444,7 @@ class AutoDiscoveryCIType(Model):
|
||||
__tablename__ = "c_ad_ci_types"
|
||||
|
||||
type_id = db.Column(db.Integer, db.ForeignKey('c_ci_types.id'))
|
||||
adr_id = db.Column(db.Integer, db.ForeignKey('c_ad_ci_types.id'))
|
||||
adr_id = db.Column(db.Integer, db.ForeignKey('c_ad_rules.id'))
|
||||
|
||||
attributes = db.Column(db.JSON) # {ad_key: cmdb_key}
|
||||
|
||||
|
@@ -1,3 +1,5 @@
|
||||
# -*- coding:utf-8 -*-
|
||||
|
||||
from api.extensions import db
|
||||
from api.lib.database import Model, TimestampMixin, SoftDeleteMixin, CRUDMixin
|
||||
|
||||
|
@@ -58,7 +58,12 @@ DEFAULT_MAIL_SENDER = ''
|
||||
CELERY_RESULT_BACKEND = "redis://127.0.0.1:6379/2"
|
||||
BROKER_URL = 'redis://127.0.0.1:6379/2'
|
||||
BROKER_VHOST = '/'
|
||||
|
||||
ONCE = {
|
||||
'backend': 'celery_once.backends.Redis',
|
||||
'settings': {
|
||||
'url': BROKER_URL,
|
||||
}
|
||||
}
|
||||
|
||||
# # SSO
|
||||
CAS_SERVER = "http://sso.xxx.com"
|
||||
|
Reference in New Issue
Block a user