Skip to content

Commit

Permalink
fix: updated audit command (#120)
Browse files Browse the repository at this point in the history
* fix: updated audit command

Signed-off-by: chenk <hen.keinan@gmail.com>

* fix: updated audit command

Signed-off-by: chenk <hen.keinan@gmail.com>

---------

Signed-off-by: chenk <hen.keinan@gmail.com>
  • Loading branch information
chen-keinan committed Aug 3, 2023
1 parent 39d6bb7 commit c7b9760
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 7 deletions.
2 changes: 0 additions & 2 deletions check/bench.go
Expand Up @@ -115,15 +115,13 @@ func (b *bench) extractAllAudits(controls *Controls) (err error) {
}
check.auditer = audit
check.customConfigs = controls.customConfigs
check.OsTypeCommand = check.Audit
} else {
for _, subCheck := range check.SubChecks {
if audit, err = b.convertAuditToRegisteredType(subCheck.AuditType, subCheck.Audit); err != nil {
return err
}
subCheck.auditer = audit
subCheck.customConfigs = controls.customConfigs
check.OsTypeCommand = check.Audit
}
}
}
Expand Down
7 changes: 2 additions & 5 deletions check/check.go
Expand Up @@ -82,7 +82,6 @@ type BaseCheck struct {
Constraints map[string][]string `yaml:"constraints"`
auditer Auditer
customConfigs []interface{}
OsTypeCommand interface{} `json:"-"`
}

// SubCheck additional check to be performed.
Expand Down Expand Up @@ -111,8 +110,7 @@ type Check struct {
IsMultiple bool `yaml:"use_multiple_values"`
auditer Auditer
customConfigs []interface{}
Reason string `json:"reason,omitempty"`
OsTypeCommand interface{} `json:"-"`
Reason string `json:"reason,omitempty"`
}

// Group is a collection of similar checks.
Expand Down Expand Up @@ -170,7 +168,6 @@ func (c *Check) Run(definedConstraints map[string][]string) {
AuditType: c.AuditType,
auditer: c.auditer,
customConfigs: c.customConfigs,
OsTypeCommand: c.OsTypeCommand,
}
} else {
subCheck = getFirstValidSubCheck(c.SubChecks, definedConstraints)
Expand Down Expand Up @@ -262,7 +259,7 @@ func runAuditCommands(c BaseCheck) (output, errMessage string, state State) {
}
if c.auditer != nil {
if len(c.customConfigs) == 0 {
c.customConfigs = append(c.customConfigs, c.OsTypeCommand)
c.customConfigs = append(c.customConfigs, c.Audit)
}
return c.auditer.Execute(c.customConfigs...)
}
Expand Down

0 comments on commit c7b9760

Please sign in to comment.