fix: add vm integrity check notify (#16206)

Co-authored-by: Qiu Jian <qiujian@yunionyun.com>
This commit is contained in:
Jian Qiu
2023-03-13 09:59:44 +08:00
committed by GitHub
co-authored by Qiu Jian
parent 8d3e3e970b
commit d1e6b14778
5 changed files with 17 additions and 0 deletions
@@ -11,3 +11,6 @@
{{- if eq .resource_type "image" }}
镜像{{ $d.name }}完整性校验失败
{{- end -}}
{{- if eq .resource_type "vm_integrity" }}
主机{{ $d.name }}完整性校验失败
{{- end -}}
+1
View File
@@ -136,6 +136,7 @@ const (
TOPIC_RESOURCE_WORKER = "worker"
TOPIC_RESOURCE_NET = "net"
TOPIC_RESOURCE_SERVICE = "service"
TOPIC_RESOURCE_VM_INTEGRITY_CHECK = "vm_integrity"
SUBSCRIBER_TYPE_ROLE = "role"
SUBSCRIBER_TYPE_ROBOT = "robot"
+6
View File
@@ -433,3 +433,9 @@ func FetchNotifyAdminRecipients(ctx context.Context, region string, users []stri
}
}
}
func NotifyVmIntegrity(ctx context.Context, name string) {
data := jsonutils.NewDict()
data.Add(jsonutils.NewString(name), "name")
SystemExceptionNotifyWithResult(ctx, api.ActionChecksumTest, api.TOPIC_RESOURCE_DB_TABLE_RECORD, api.ResultFailed, data)
}
+5
View File
@@ -509,6 +509,11 @@ func init() {
"database table record",
"数据库记录",
},
sI18nElme{
api.TOPIC_RESOURCE_VM_INTEGRITY_CHECK,
"vm server integrity check",
"虚拟主机完整性校验",
},
sI18nElme{
api.TOPIC_RESOURCE_ACTION_LOG,
"action log",
+2
View File
@@ -332,6 +332,7 @@ func (sm *STopicManager) InitializeData() error {
case DefaultChecksumTestFailed:
t.addResources(
notify.TOPIC_RESOURCE_DB_TABLE_RECORD,
notify.TOPIC_RESOURCE_VM_INTEGRITY_CHECK,
notify.TOPIC_RESOURCE_CLOUDPODS_COMPONENT,
notify.TOPIC_RESOURCE_SNAPSHOT,
notify.TOPIC_RESOURCE_IMAGE,
@@ -682,6 +683,7 @@ func init() {
notify.TOPIC_RESOURCE_ACCOUNT_STATUS: 38,
notify.TOPIC_RESOURCE_NET: 39,
notify.TOPIC_RESOURCE_SERVICE: 40,
notify.TOPIC_RESOURCE_VM_INTEGRITY_CHECK: 41,
},
)
converter.registerAction(