mirror of
https://github.com/fleetdm/fleet
synced 2026-05-23 00:49:03 +00:00
fix: use a better query and update test (#24477)
> Related issue: #24204 # Checklist for submitter If some of the following don't apply, delete the relevant line. <!-- Note that API documentation changes are now addressed by the product design team. --> - [x] Added/updated tests - [x] Manual QA for all new/changed functionality
This commit is contained in:
parent
1d839054a2
commit
8fc706907c
2 changed files with 3 additions and 8 deletions
|
|
@ -1404,16 +1404,10 @@ func (ds *Datastore) filterHostsByOSSettingsStatus(sql string, opt fleet.HostLis
|
|||
// or are servers. Similar logic could be applied to macOS hosts but is not included in this
|
||||
// current implementation.
|
||||
|
||||
// TODO once testLabelsListHostsInLabelOSSettings enrolls hosts into the correct MDM, switch to this:
|
||||
/*sqlFmt := ` AND (
|
||||
sqlFmt := ` AND (
|
||||
(h.platform = 'windows' AND mwe.host_uuid IS NOT NULL AND hmdm.enrolled = 1) -- windows
|
||||
OR (h.platform IN ('darwin', 'ios', 'ipados') AND ne.id IS NOT NULL AND hmdm.enrolled = 1) -- apple
|
||||
OR (h.platform = 'ubuntu' OR h.os_version LIKE 'Fedora%%') -- linux
|
||||
)`*/
|
||||
|
||||
sqlFmt := ` AND (
|
||||
(h.platform IN('windows', 'darwin', 'ios', 'ipados') AND (ne.id IS NOT NULL OR mwe.host_uuid IS NOT NULL) AND hmdm.enrolled = 1)
|
||||
OR (h.platform = 'ubuntu' OR h.os_version LIKE 'Fedora%%')
|
||||
)`
|
||||
|
||||
if opt.TeamFilter == nil {
|
||||
|
|
|
|||
|
|
@ -1550,7 +1550,8 @@ func testLabelsListHostsInLabelOSSettings(t *testing.T, db *Datastore) {
|
|||
|
||||
// add two hosts to MDM to enforce disk encryption, fleet doesn't enforce settings on centos so h3 is not included
|
||||
for _, h := range []*fleet.Host{h1, h2} {
|
||||
nanoEnrollAndSetHostMDMData(t, db, h, false)
|
||||
windowsEnroll(t, db, h)
|
||||
require.NoError(t, db.SetOrUpdateMDMData(context.Background(), h.ID, false, true, "https://example.com", false, fleet.WellKnownMDMFleet, ""))
|
||||
}
|
||||
// add disk encryption key for h1
|
||||
require.NoError(t, db.SetOrUpdateHostDiskEncryptionKey(context.Background(), h1.ID, "test-key", "", ptr.Bool(true)))
|
||||
|
|
|
|||
Loading…
Reference in a new issue