Add update channels to orbit_info (#8310)

This commit is contained in:
Lucas Manuel Rodriguez 2022-10-27 11:52:18 -03:00 committed by GitHub
parent c964ba4d90
commit 7d855c3879
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 22 additions and 12 deletions

View file

@ -648,8 +648,11 @@ func main() {
&g,
r.ExtensionSocketPath(),
table.WithExtension(orbitInfoExtension{
orbitClient: orbitClient,
trw: trw,
orbitClient: orbitClient,
orbitChannel: c.String("orbit-channel"),
osquerydChannel: c.String("osqueryd-channel"),
desktopChannel: c.String("desktop-channel"),
trw: trw,
}),
)

View file

@ -13,8 +13,11 @@ import (
// orbitInfoExtension implements an extension table that provides info about Orbit.
type orbitInfoExtension struct {
orbitClient *service.OrbitClient
trw *token.ReadWriter
orbitClient *service.OrbitClient
orbitChannel string
osquerydChannel string
desktopChannel string
trw *token.ReadWriter
}
var _ orbit_table.Extension = orbitInfoExtension{}
@ -31,6 +34,9 @@ func (o orbitInfoExtension) Columns() []table.ColumnDefinition {
table.TextColumn("device_auth_token"),
table.TextColumn("enrolled"),
table.TextColumn("last_recorded_error"),
table.TextColumn("orbit_channel"),
table.TextColumn("osqueryd_channel"),
table.TextColumn("desktop_channel"),
}
}
@ -53,12 +59,13 @@ func (o orbitInfoExtension) GenerateFunc(_ context.Context, _ table.QueryContext
}
}
return []map[string]string{
{
"version": v,
"device_auth_token": token,
"enrolled": strconv.FormatBool(o.orbitClient.Enrolled()),
"last_recorded_error": lastRecordedError,
},
}, nil
return []map[string]string{{
"version": v,
"device_auth_token": token,
"enrolled": strconv.FormatBool(o.orbitClient.Enrolled()),
"last_recorded_error": lastRecordedError,
"orbit_channel": o.orbitChannel,
"osqueryd_channel": o.osquerydChannel,
"desktop_channel": o.desktopChannel,
}}, nil
}