fix: cloud account/provider missing event logs for

delete/enable/disable/change_project
This commit is contained in:
Qiu Jian
2019-04-20 17:05:29 +08:00
parent 8e508b6f31
commit ffbb7e362b
6 changed files with 54 additions and 7 deletions
@@ -21,6 +21,7 @@ import (
"yunion.io/x/log"
"yunion.io/x/onecloud/pkg/mcclient"
"yunion.io/x/onecloud/pkg/util/logclient"
)
type SEnabledStatusStandaloneResourceBase struct {
@@ -52,6 +53,7 @@ func (self *SEnabledStatusStandaloneResourceBase) PerformEnable(ctx context.Cont
return nil, err
}
OpsLog.LogEvent(self, ACT_ENABLE, "", userCred)
logclient.AddSimpleActionLog(self, logclient.ACT_ENABLE, nil, userCred, true)
}
return nil, nil
}
@@ -71,6 +73,7 @@ func (self *SEnabledStatusStandaloneResourceBase) PerformDisable(ctx context.Con
return nil, err
}
OpsLog.LogEvent(self, ACT_DISABLE, "", userCred)
logclient.AddSimpleActionLog(self, logclient.ACT_DISABLE, nil, userCred, true)
}
return nil, nil
}
+12
View File
@@ -269,6 +269,18 @@ func (model *SVirtualResourceBase) PerformChangeOwner(ctx context.Context, userC
return nil, err
}
OpsLog.SyncOwner(model, former, userCred)
notes := struct {
OldProjectId string
OldProject string
NewProjectId string
NewProject string
}{
OldProjectId: former.Id,
OldProject: former.Name,
NewProjectId: tobj.GetId(),
NewProject: tobj.GetName(),
}
logclient.AddActionLogWithContext(ctx, model, logclient.ACT_CHANGE_OWNER, notes, userCred, true)
return nil, nil
}