Skip to content

feat(import_devices): check devices.csv with linuxmuster-tools instea… - #211

Open
kiarn wants to merge 1 commit into
masterfrom
feat/import-devices-lmntools-check
Open

kiarn wants to merge 1 commit into
masterfrom
feat/import-devices-lmntools-check

Conversation

@kiarn

@kiarn kiarn commented Oct 11, 2026

Copy link
Copy Markdown
Member

Check devices.csv with linuxmuster-tools instead of sophomorix-device --dry-run

When sophomorix-device --dry-run fails, linuxmuster-import-devices only says that it failed: the reason is in the log, and the check stops at the first problem. An admin with several mistakes in devices.csv has to run the import once per mistake.

This PR replaces the dry-run gate with check_all_schools() from linuxmuster-tools 7.4.19, which validates the devices.csv of every school at once and reports every problem with its file and line, on the console and in the log:

❌ hostname.too_long pc0123456789 (school2.devices.csv:12)
❌ mac.duplicate AA:BB:CC:DD:EE:01 (devices.csv:3,8)
⚠️ ip.multischool 10.0.0.1 (devices.csv:1, school2.devices.csv:1)

Each code is documented in the devices README of linuxmuster-tools.

What changes

  • checkDevices() runs before the sync and exits with status 1 if an error is found. Warnings are printed but do not stop the import.
  • If linuxmuster-tools can not be loaded, the import stops with a readable message instead of falling back to sophomorix.
  • runSophomorixDeviceSync() now only runs sophomorix-device --sync, unchanged otherwise.
  • debian/control: new dependency linuxmuster-tools7 (>= 7.4.19). It was already pulled in through linuxmuster-webui7.

Differences with sophomorix-device --dry-run

Check --dry-run This PR
Reporting Stops at the first problem Lists all problems, with file and line
Hostname longer than 15 characters (<school>-<hostname>), for roles getting a machine account Not checked Error (AD naming rules)
Hostname made of digits only, starting with a non-alphanumeric character, ending with - Not checked Error
Same hostname twice Not blocking Error
Empty LINBO group Accepted Error
Same IP in two schools Error at sync time Warning only (see below)
Comparison with the AD Yes No, the files only

Because of the new rules, this check can block an import that passes today. To be discussed: the 15 characters limit and the duplicate hostname in particular.

Known limitation: same IP in two schools

The check lets an IP shared between two schools through, as a warning: a fileserver legitimately carries the same address in each school. But sophomorix-device --sync still stops on it, because %ip_seen (sophomorix-device line 125) is never cleared between the files of the schools (line 1937). Such an import would print "devices.csv check OK" and then fail at the sync. This has to be fixed in sophomorix.

🤖 Generated with Claude Code

…d of sophomorix-device --dry-run

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.

1 participant