mirror of
https://github.com/fleetdm/fleet
synced 2026-05-23 17:08:53 +00:00
filter for hosts_count > 0 in software title query (#16225)
for #15964, pair programmed with @jacobshandling --------- Co-authored-by: Jacob Shandling <jacob@fleetdm.com>
This commit is contained in:
parent
433fe225d8
commit
4d90b8ee6b
3 changed files with 9 additions and 1 deletions
1
changes/15964-software
Normal file
1
changes/15964-software
Normal file
|
|
@ -0,0 +1 @@
|
|||
* Fixed a bug that caused the software/titles page to error
|
||||
|
|
@ -184,6 +184,7 @@ JOIN software_titles_host_counts sthc ON sthc.software_title_id = st.id
|
|||
%s
|
||||
-- placeholder for optional extra WHERE filter
|
||||
WHERE sthc.team_id = ? %s
|
||||
AND sthc.hosts_count > 0
|
||||
GROUP BY st.id`
|
||||
|
||||
cveJoinType := "LEFT"
|
||||
|
|
|
|||
|
|
@ -215,10 +215,16 @@ func testSoftwareSyncHostsSoftwareTitles(t *testing.T, ds *Datastore) {
|
|||
|
||||
checkTableTotalCount(3)
|
||||
|
||||
// update host4 (team2), remove all software and delete team
|
||||
// update host4 (team2), remove all software
|
||||
software4 = []fleet.Software{}
|
||||
_, err = ds.UpdateHostSoftware(ctx, host4.ID, software4)
|
||||
require.NoError(t, err)
|
||||
require.NoError(t, ds.ReconcileSoftwareTitles(ctx))
|
||||
require.NoError(t, ds.SyncHostsSoftware(ctx, time.Now()))
|
||||
require.NoError(t, ds.SyncHostsSoftwareTitles(ctx, time.Now()))
|
||||
listSoftwareTitlesCheckCount(t, ds, 0, 0, team2Opts, false)
|
||||
|
||||
// delete team
|
||||
require.NoError(t, ds.DeleteTeam(ctx, team2.ID))
|
||||
|
||||
// this call will remove team2 from the software host counts table
|
||||
|
|
|
|||
Loading…
Reference in a new issue