Skip to content

Commit e4867b5

Browse files
committed
整合系统操作日志
1 parent 7d92d12 commit e4867b5

46 files changed

Lines changed: 708 additions & 443 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
136 Bytes
Binary file not shown.
104 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.

Ops/celery.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
Queue('ansible', Exchange('ansible', type='direct'), routing_key='ansible'),
2525
Queue('fort', Exchange('fort', type='direct'), routing_key='fort'),
2626
Queue('plan', Exchange('plan', type='direct'), routing_key='plan'),
27+
Queue('commons', Exchange('commons', type='direct'), routing_key='commons'),
2728
)
2829

2930
app.conf.task_default_queue = 'default'

Ops/settings.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@
5353
'assets.tasks.*': {'queue': 'default', 'routing_key': 'default'},
5454
'task.tasks.*': {'queue': 'ansible', 'routing_key': 'ansible'},
5555
'fort.tasks.*': {'queue': 'fort', 'routing_key': 'fort'},
56+
'commons.tasks.*': {'queue': 'commons', 'routing_key': 'commons'},
5657
}
5758

5859
# 执行ansible命令使用的redis信息
@@ -62,9 +63,12 @@
6263
REDIS_PASSWORD = None
6364

6465
# mongodb配置信息
65-
MONGODB_HOST = '127.0.0.1'
66+
MONGODB_HOST = '10.1.7.198'
6667
MONGODB_PORT = 27017
67-
COMMANDS_DB = 'commands'
68+
MONGODB_USER = 'admin'
69+
MONGODB_PASS = '123456'
70+
RECORD_DB = 'records'
71+
RECORD_COLL = 'ops'
6872

6973
# Application definition
7074
INSTALLED_APPS = [
@@ -88,6 +92,7 @@
8892
'wiki.apps.WikiConfig',
8993
'haystack.apps.HaystackConfig',
9094
'dbmanager.apps.DbmanagerConfig',
95+
'commons.apps.CommonsConfig',
9196
]
9297

9398
# 全局搜索配置

Ops/urls.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,16 @@
1616
from django.urls import path, include, re_path
1717
from django.views.static import serve
1818
from django.conf import settings
19-
from Ops import views
19+
from commons import views
2020

2121
urlpatterns = [
2222
path('', views.dashboard, name='dashboard'),
2323
path(r'login/', views.login, name='login'),
2424
path(r'create_code/', views.gen_code_img, name='create_code'),
2525
path(r'logout/', views.logout, name='logout'),
2626
path(r'lock_screen/', views.lock_screen, name='lock_screen'),
27+
path(r'system_log/', views.system_log, name='system_log'),
28+
path(r'get_system_log/', views.get_system_log, name='get_system_log'),
2729
path(r'api/', include('api.urls')),
2830
path(r'run/', include('task.urls')),
2931
path(r'users/', include('users.urls')),
-658 Bytes
Binary file not shown.
-88 Bytes
Binary file not shown.
-496 Bytes
Binary file not shown.

api/serializers.py

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from task.models import AnsibleInventory
44
from rest_framework import serializers
55
from assets.models import *
6-
from users.models import UserProfile, UserLog
6+
from users.models import UserProfile
77
from django.contrib.auth.models import Permission, Group
88
from utils.crypt_pwd import CryptPwd
99
from fort.models import *
@@ -194,18 +194,6 @@ class Meta:
194194
fields = ('id', 'name', 'user_set', 'permissions')
195195

196196

197-
class UserLogSerializer(serializers.ModelSerializer):
198-
class Meta:
199-
model = UserLog
200-
fields = '__all__'
201-
202-
203-
class AssetsLogSerializer(serializers.ModelSerializer):
204-
class Meta:
205-
model = AssetsLog
206-
fields = '__all__'
207-
208-
209197
class InventorySerializer(serializers.ModelSerializer):
210198
class Meta:
211199
model = AnsibleInventory

0 commit comments

Comments
 (0)