Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(systemd): publish agent information on child devices #112

Merged
merged 1 commit into from
Oct 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions images/child-device-container/child.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ COPY common/utils/workflows/firmware_update.toml /etc/tedge/operations/
COPY common/utils/configure-device/runner.sh /usr/share/configure-device/
COPY common/utils/set-startup-info /usr/share/configure-device/scripts.d/90_set-startup-info

# Inventory scripts
# FIXME: tedge should support this out of the box, but currently the c8y_Agent fragment
# is published by the mapper and not the tedge-agent, so it needs a mapping rule.
COPY common/utils/set-agent-info /usr/share/tedge-inventory/scripts.d/50_c8y_Agent

ENV TEDGE_MQTT_CLIENT_HOST=tedge
ENV TEDGE_HTTP_CLIENT_HOST=tedge
ENV TEDGE_C8Y_PROXY_CLIENT_HOST=tedge
Expand Down
5 changes: 5 additions & 0 deletions images/child-device-systemd/child.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,11 @@ COPY common/utils/enroll/enroll.sh /usr/bin/
RUN ln -sf /usr/bin/enroll.sh /usr/share/configure-device/scripts.d/70_enroll
COPY common/utils/set-startup-info /usr/share/configure-device/scripts.d/90_set-startup-info

# Inventory scripts
# FIXME: tedge should support this out of the box, but currently the c8y_Agent fragment
# is published by the mapper and not the tedge-agent, so it needs a mapping rule.
COPY common/utils/set-agent-info /usr/share/tedge-inventory/scripts.d/50_c8y_Agent

COPY child-device-systemd/config/system.toml /etc/tedge/
COPY child-device-systemd/config/tedge.toml /etc/tedge/
COPY common/utils/workflows/firmware_update.toml /etc/tedge/operations/
Expand Down
6 changes: 6 additions & 0 deletions images/common/utils/set-agent-info
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/sh
set -e
TEDGE_VERSION="$(tedge --version | cut -d' ' -f2- ||:)"
printf 'name="%s"\n' "thin-edge.io"
printf 'url="%s"\n' "https://thin-edge.io"
printf 'version="%s"\n' "${TEDGE_VERSION:-unknown}"
7 changes: 7 additions & 0 deletions tests/debian-systemd/children-container/telemetry.robot
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,10 @@ Sends measurements
Skip Container does not publish measurements by default
${date_from}= Get Test Start Time
Cumulocity.Device Should Have Measurements minimum=2 after=${date_from} timeout=30

Agent information
${mo}= Cumulocity.Device Should Have Fragments c8y_Agent
Log ${mo["c8y_Agent"]}
Should Not Be Empty ${mo["c8y_Agent"]["name"]}
Should Not Be Empty ${mo["c8y_Agent"]["version"]}
Should Not Be Empty ${mo["c8y_Agent"]["url"]}
7 changes: 7 additions & 0 deletions tests/debian-systemd/children-systemd/telemetry.robot
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,10 @@ Sends measurements
Skip Container does not publish measurements by default
${date_from}= Get Test Start Time
Cumulocity.Device Should Have Measurements minimum=2 after=${date_from} timeout=30

Agent information
${mo}= Cumulocity.Device Should Have Fragments c8y_Agent
Log ${mo["c8y_Agent"]}
Should Not Be Empty ${mo["c8y_Agent"]["name"]}
Should Not Be Empty ${mo["c8y_Agent"]["version"]}
Should Not Be Empty ${mo["c8y_Agent"]["url"]}