From cfb3c7ae9fa6b851e21c1fc52b3fd2846c557c3a Mon Sep 17 00:00:00 2001 From: Sharvil Shah Date: Wed, 28 Sep 2022 01:29:25 +0530 Subject: [PATCH] switch orbit enroll logic to use osquery_host_id (#7984) --- server/datastore/mysql/hosts.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/server/datastore/mysql/hosts.go b/server/datastore/mysql/hosts.go index cea1c419fe..2f52d18bbd 100644 --- a/server/datastore/mysql/hosts.go +++ b/server/datastore/mysql/hosts.go @@ -849,10 +849,10 @@ func (ds *Datastore) EnrollOrbit(ctx context.Context, hardwareUUID string, orbit var host fleet.Host err := ds.withRetryTxx(ctx, func(tx sqlx.ExtContext) error { - err := sqlx.GetContext(ctx, tx, &host, `SELECT id FROM hosts WHERE uuid = ?`, hardwareUUID) + err := sqlx.GetContext(ctx, tx, &host, `SELECT id FROM hosts WHERE osquery_host_id = ?`, hardwareUUID) switch { case err == nil: - sqlUpdate := `UPDATE hosts SET orbit_node_key = ? WHERE uuid = ? ` + sqlUpdate := `UPDATE hosts SET orbit_node_key = ? WHERE osquery_host_id = ? ` _, err := tx.ExecContext(ctx, sqlUpdate, orbitNodeKey, hardwareUUID) if err != nil { return ctxerr.Wrap(ctx, err, "orbit enroll error updating host details")