Skip to content

System: OS-Version aus /etc/issue per MQTT bereitstellen - #4338

Closed
kevinwieland wants to merge 2 commits into
openWB:masterfrom
kevinwieland:feature/os-version
Closed

kevinwieland wants to merge 2 commits into
openWB:masterfrom
kevinwieland:feature/os-version

Conversation

@kevinwieland

@kevinwieland kevinwieland commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Zusammenfassung

  • OS-Version in runs/setup_network.sh analog zu IP-Adresse, MAC-Adresse und Hostname ermitteln.
  • Erste nicht leere Zeile aus /etc/issue lesen, Login-Platzhalter \n und \l sowie umgebende Leerzeichen entfernen; bei fehlender Information unknown verwenden.
  • Als JSON-String unter openWB/system/os_version retained veröffentlichen.
  • Topic-Registrierung, Standardwert und MQTT-Leseberechtigung für die Systemkonfiguration ergänzen.

Zugehörige UI

Anzeige unter „System → System → System Information“, direkt unter „Hostname“:
openWB/openwb-ui-settings#1174

Prüfung

  • bash -n runs/setup_network.sh
  • Sieben Auslese- und MQTT-Publikationsfälle mit Testdateien und gemocktem Publisher geprüft.
  • Topic-Registrierung, Standardwert und ACL geprüft.
  • Noch nicht auf einer echten openWB getestet.

Keine PHP-Erweiterung.

Summary by Sourcery

Provide the operating system version through MQTT for system information display.

New Features:

  • Publish the operating system version from /etc/issue as a retained JSON string on openWB/system/os_version.
  • Expose the OS version topic through the system configuration with a default value and read access.

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've found 2 issues

Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location path="packages/helpermodules/update_config.py" line_range="638" />
<code_context>
         "^openWB/system/mac_address$",
         "^openWB/system/mqtt/bridge/[0-9]+$",
         "^openWB/system/mqtt/valid_partner_ids$",
+        "^openWB/system/os_version$",
         "^openWB/system/pnp_ip$",
         "^openWB/system/release_train$",
</code_context>
<issue_to_address>
**Existing installs cannot read OS version**

When an existing installation has user management enabled and its installed ACL version is 13, `update_acls()` compares the installed and template ACL versions and returns without syncing when they match. Because the default dynamic-security template keeps `openwb-version:13`, existing installations at version 13 never receive the new `os_version` read ACL, so the UI cannot read the published value.

Bump the ACL template version so existing installations run the ACL synchronization and receive the new permission.
</issue_to_address>

### Comment 2
<location path="packages/helpermodules/update_config.py" line_range="781" />
<code_context>
         ("openWB/system/ip_address", "unknown"),
         ("openWB/system/mqtt/valid_partner_ids", []),
         ("openWB/system/mac_address", "unknown"),
+        ("openWB/system/os_version", "unknown"),
         ("openWB/system/pnp_ip", {"address": "192.168.193.250", "prefix": 24}),
         ("openWB/system/release_train", "master"),
</code_context>
<issue_to_address>
**Actual version overwritten by default**

When the topic has no retained value and the default-publication flow overlaps the setup script’s retained publication, `UpdateConfig.update()` runs `__pub_missing_defaults()` while `setup_network.sh` publishes the detected version. If the update process has already classified the topic as missing, its later default publication replaces the retained actual version with `unknown`, so readers see an incorrect OS version until the next publish.

Ensure missing-default publication cannot overwrite a value published concurrently, for example by rechecking retained state immediately before publishing the default.

Also at `runs/setup_network.sh:195`.
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨

Comment thread packages/helpermodules/update_config.py Resolved
("openWB/system/ip_address", "unknown"),
("openWB/system/mqtt/valid_partner_ids", []),
("openWB/system/mac_address", "unknown"),
("openWB/system/os_version", "unknown"),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Medium · Actual version overwritten by default

When the topic has no retained value and the default-publication flow overlaps the setup script’s retained publication, UpdateConfig.update() runs __pub_missing_defaults() while setup_network.sh publishes the detected version. If the update process has already classified the topic as missing, its later default publication replaces the retained actual version with unknown, so readers see an incorrect OS version until the next publish.

Ensure missing-default publication cannot overwrite a value published concurrently, for example by rechecking retained state immediately before publishing the default.

Also at runs/setup_network.sh:195.

Prompt for AI agents
In `packages/helpermodules/update_config.py` at line 781:

**Actual version overwritten by default**

When the topic has no retained value and the default-publication flow overlaps the setup script’s retained publication, `UpdateConfig.update()` runs `__pub_missing_defaults()` while `setup_network.sh` publishes the detected version. If the update process has already classified the topic as missing, its later default publication replaces the retained actual version with `unknown`, so readers see an incorrect OS version until the next publish.

Ensure missing-default publication cannot overwrite a value published concurrently, for example by rechecking retained state immediately before publishing the default.

Also at `runs/setup_network.sh:195`.

@benderl

benderl commented Nov 17, 2026

Copy link
Copy Markdown
Contributor

Ist bereits in #4251 enthalten.

@benderl benderl closed this Nov 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants