mirror of
https://github.com/fleetdm/fleet
synced 2026-05-24 09:28:54 +00:00
Check env var along with app config for software inv (#2406)
This commit is contained in:
parent
c28e3bbc9a
commit
f44c809d85
1 changed files with 3 additions and 1 deletions
|
|
@ -4,6 +4,7 @@ import (
|
||||||
"context"
|
"context"
|
||||||
"database/sql"
|
"database/sql"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"os"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
|
@ -155,7 +156,8 @@ func (d *Datastore) SaveHost(ctx context.Context, host *fleet.Host) error {
|
||||||
return errors.Wrap(err, "failed to get app config to see if we need to update host users and inventory")
|
return errors.Wrap(err, "failed to get app config to see if we need to update host users and inventory")
|
||||||
}
|
}
|
||||||
|
|
||||||
if host.HostSoftware.Modified && ac.HostSettings.EnableSoftwareInventory && len(host.HostSoftware.Software) > 0 {
|
softwareInventoryEnabled := os.Getenv("FLEET_BETA_SOFTWARE_INVENTORY") != "" || ac.HostSettings.EnableSoftwareInventory
|
||||||
|
if host.HostSoftware.Modified && softwareInventoryEnabled && len(host.HostSoftware.Software) > 0 {
|
||||||
if err := saveHostSoftwareDB(ctx, tx, host); err != nil {
|
if err := saveHostSoftwareDB(ctx, tx, host); err != nil {
|
||||||
return errors.Wrap(err, "failed to save host software")
|
return errors.Wrap(err, "failed to save host software")
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue