Skip to content

Commit 7bcd1b7

Browse files
fix: exit with returncode 0 if no jwt token is obtained over dbus
`mender-inventory-mender-configure` produces an error when failing to fetch the JWT token over DBus. If we exit with 1 mender-update will log: ``` raspberrypi mender-update[1070]: An authentication token could not be obtained over DBus. mender-update[1029]: record_id=3 severity=error time="2025-Jun-12 21:53:25.802076" name="Global" msg="'/usr/share/mender/inventory/mender-inventory-mender-configure' failed: Process... ``` Now it will log: `raspberrypi mender-update[1070]: mender-inventory-mender-configure: An authentication token could not be obtained over DBus.` Changelog: Exit with returncode 0 in `mender-inventory-mender-configure` if no jwt token is obtained over dbus. This stops mender-update from logging errors from the inventory script before mender-auth is ready or if the device isn't accepted. Ticket: MEN-8591 Signed-off-by: Daniel Skinstad Drabitzius <daniel.drabitzius@northern.tech>
1 parent c83502e commit 7bcd1b7

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/mender-inventory-mender-configure

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,9 @@ SERVER="$(echo "$DBUS_REPLY" | sed -ne '2p')"
4444

4545
if [ -z "$AUTH_TOKEN" ]; then
4646
echo "mender-inventory-mender-configure: An authentication token could not be obtained over DBus."
47-
exit 1
47+
# Don't produce an error. Most likely mender-auth is not ready or
48+
# the device hasn't been accepted
49+
exit 0
4850
fi
4951
if [ -z "$SERVER" ]; then
5052
echo "mender-inventory-mender-configure: A server address could not be obtained over DBus."

tests/unit/test_inventory.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ testInvalidEndpoint() {
7676
testMissingJwtToken() {
7777
export TEST_AUTH_TOKEN_EMPTY=1
7878
output="$("${inv_script}")"
79-
assertNotEquals 0 $?
79+
assertEquals 0 $?
8080
assertEquals "" "${output}"
8181
assertEquals "" "$(cat "$TEST_HTTP_LOG" 2>/dev/null)"
8282
}

0 commit comments

Comments
 (0)