forked from TrueCloudLab/frostfs-node
[#255] services/audit: Complete audit report after the last check
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
parent
4dc09b19f3
commit
33804e024d
3 changed files with 19 additions and 4 deletions
|
@ -71,6 +71,10 @@ func (c *Context) expired() bool {
|
|||
}
|
||||
}
|
||||
|
||||
func (c *Context) complete() {
|
||||
c.report.Complete()
|
||||
}
|
||||
|
||||
func (c *Context) writeReport() {
|
||||
c.log.Debug("writing audit report...")
|
||||
|
||||
|
|
|
@ -8,21 +8,27 @@ import (
|
|||
func (c *Context) Execute() {
|
||||
c.init()
|
||||
|
||||
for _, check := range []struct {
|
||||
checks := []struct {
|
||||
name string
|
||||
exec func()
|
||||
}{
|
||||
{name: "PoR", exec: c.executePoR},
|
||||
{name: "PoP", exec: c.executePoP},
|
||||
{name: "PDP", exec: c.executePDP},
|
||||
} {
|
||||
c.log.Debug(fmt.Sprintf("executing %s check...", check.name))
|
||||
}
|
||||
|
||||
for i := range checks {
|
||||
c.log.Debug(fmt.Sprintf("executing %s check...", checks[i].name))
|
||||
|
||||
if c.expired() {
|
||||
break
|
||||
}
|
||||
|
||||
check.exec()
|
||||
checks[i].exec()
|
||||
|
||||
if i == len(checks)-1 {
|
||||
c.complete()
|
||||
}
|
||||
}
|
||||
|
||||
c.writeReport()
|
||||
|
|
|
@ -31,3 +31,8 @@ func NewReport(cid *container.ID) *Report {
|
|||
func (r *Report) Result() *audit.Result {
|
||||
return r.res
|
||||
}
|
||||
|
||||
// Complete completes audit report.
|
||||
func (r *Report) Complete() {
|
||||
r.res.SetComplete(true)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue