mirror of
https://github.com/empayre/fleet.git
synced 2024-11-06 17:05:18 +00:00
switch orbit enroll logic to use osquery_host_id (#7984)
This commit is contained in:
parent
2eb24b974a
commit
cfb3c7ae9f
@ -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")
|
||||
|
Loading…
Reference in New Issue
Block a user