-
-
Notifications
You must be signed in to change notification settings - Fork 363
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
nut-scanner: fix device-name collisions in generated conf #2247
nut-scanner: fix device-name collisions in generated conf #2247
Conversation
When nut-scanner is called separately, to scan different buses, it will generate similar names for each of these: * USB scan > [nutdev1] > ... * NUT scan > [nutdev1] > ... * ... As a result, one can't just redirect nut-scanner outputs directly to ups.conf, without a 'sed' hack workaround. Solution: simply refine the device names, like "nutdev-<method><id>". Ex: nutdev-usb1, nutdev-usb2, nutdev-nut1, nutdev-snmp1, nutdev-simulation1, ... Signed-off-by: Arnaud Quette <[email protected]>
Signed-off-by: Arnaud Quette <[email protected]>
@jimklimov CI issues, unrelated to the PR (trivial) changes |
Currently have no means to test (stuck on a train) but the principal idea is great and should make chaining different nut-scanner commands, while outputting into one configuration file, much easier and reduce the need to hack around the generated UPS names. This'd also be useful for my use cases. |
Note that #2246, as for all my dummy-ups work, is there for when you don't have access to real devices (or for CI). I coded that when on a plane ... |
For coding on a plane or a boat, did I already suggest Termux? An Android app that is a debian-ish Linux VM, can build NUT for native ARM for example :) |
Got it on all phones and tabs 😉 |
Finally back to the online world, re-read this PR and was like "how did I never hit this, aren't numbers sequential for all found devices on whatever bus?"... and then saw the part about "running separately for different buses". Makes sense and LGTM then :) |
…device-name-collisions
❌ Build nut 2.8.1.1274-master failed (commit b11207fd48 by @jimklimov) |
@aquette : changes seem to work, NIT complains about test result mismatch (will post a fix in a sec) ;) Now that we have a |
…d section names to nut-scanner evolution Signed-off-by: Jim Klimov <[email protected]>
…device-name-collisions
…etworkupstools#2247] Signed-off-by: Jim Klimov <[email protected]>
When nut-scanner is called separately, to scan different buses, it will generate similar names for each of these:
Solution: simply refine the device names, like "nutdev-".
Ex: nutdev-usb1, nutdev-usb2, nutdev-nut1, nutdev-snmp1, nutdev-simulation1, ...
Closes: #2243
UPDATE/FYI: As recognized during investigation for #2317 the actual device numbering (in case of multi-bus scanning) is still monotonous, assigned during
ups.conf
style rendition of discovered configuration (actually not defined outside a renderer). So a single run with many media types enabled would yield e.g. "nutdev-usb1, nutdev-usb2, nutdev-nut3, nutdev-snmp4, nutdev-simulation5, ..."