Skip to content

Commit

Permalink
Add IP geoloc and OS version to device properties
Browse files Browse the repository at this point in the history
Added these two attributes so that they could be discovered through the
client API
  • Loading branch information
System Administrator committed Jun 14, 2024
1 parent b976bc0 commit 733d62a
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
18 changes: 18 additions & 0 deletions doni/driver/hardware_type/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,24 @@
"A token used to join the device to a k3s cluster during bootstrap."
),
),
WorkerField(
"balena_location",
schema=args.STRING,
required=False,
private=False,
description=(
"Device IP geolocation from Balena"
),
),
WorkerField(
"os_version",
schema=args.STRING,
required=False,
private=False,
description=(
"Version of the operating system running on the device"
),
),
WorkerField(
"channels",
schema=CHANNELS_SCHEMA,
Expand Down
3 changes: 3 additions & 0 deletions doni/driver/worker/balena.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,9 @@ def process(
if balena_device["is_online"]
else balena_device["last_connectivity_event"]
)
hardware.properties["balena_location"] = balena_device["location"]
hardware.properties["os_version"] = balena_device["os_version"] + " " + balena_device["os_variant"]
hardware.save()

return WorkerResult.Success(state_details)

Expand Down

0 comments on commit 733d62a

Please sign in to comment.