for #17489, found an edge case during extra testing.
This commit is contained in:
@@ -1565,7 +1565,11 @@ func deduceMDMNameWindows(data map[string]string) string {
|
||||
}
|
||||
|
||||
func directIngestMDMWindows(ctx context.Context, logger log.Logger, host *fleet.Host, ds fleet.Datastore, rows []map[string]string) error {
|
||||
if len(rows) != 1 {
|
||||
if len(rows) == 0 {
|
||||
// no mdm information in the registry
|
||||
return ds.SetOrUpdateMDMData(ctx, host.ID, false, false, "", false, "", "")
|
||||
}
|
||||
if len(rows) > 1 {
|
||||
logger.Log("component", "service", "method", "directIngestMDMWindows", "warn",
|
||||
fmt.Sprintf("mdm expected single result got %d", len(rows)))
|
||||
// assume the extension is not there
|
||||
|
||||
@@ -715,6 +715,14 @@ func TestDirectIngestMDMWindows(t *testing.T) {
|
||||
wantIsServer: false,
|
||||
wantServerURL: "",
|
||||
},
|
||||
{
|
||||
name: "off no rows",
|
||||
data: []map[string]string{},
|
||||
wantEnrolled: false,
|
||||
wantInstalledFromDep: false,
|
||||
wantIsServer: false,
|
||||
wantServerURL: "",
|
||||
},
|
||||
{
|
||||
name: "on automatic",
|
||||
data: []map[string]string{
|
||||
|
||||
Reference in New Issue
Block a user