ignore loop devices as well
This commit is contained in:
parent
ff9c271c76
commit
cfbbdc89e7
@ -395,11 +395,12 @@ func (a *Agent) GetWMIInfo() map[string]interface{} {
|
||||
|
||||
// disks
|
||||
block, err := ghw.Block(ghw.WithDisableWarnings())
|
||||
ignore := []string{"ram", "loop"}
|
||||
if err != nil {
|
||||
a.Logger.Errorln("ghw.Block()", err)
|
||||
} else {
|
||||
for _, disk := range block.Disks {
|
||||
if disk.IsRemovable || strings.Contains(disk.Name, "ram") {
|
||||
if disk.IsRemovable || contains(disk.Name, ignore) {
|
||||
continue
|
||||
}
|
||||
ret := fmt.Sprintf("%s %s %s %s %s %s", disk.Vendor, disk.Model, disk.StorageController, disk.DriveType, disk.Name, ByteCountSI(disk.SizeBytes))
|
||||
|
@ -311,6 +311,15 @@ func removeNewlines(s string) string {
|
||||
return strings.ReplaceAll(s, "\n", "")
|
||||
}
|
||||
|
||||
func contains(s string, substrs []string) bool {
|
||||
for _, substr := range substrs {
|
||||
if strings.Contains(s, substr) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func stringInSlice(a string, list []string) bool {
|
||||
for _, b := range list {
|
||||
if b == a {
|
||||
|
Loading…
Reference in New Issue
Block a user