-
-
Couldn't load subscription status.
- Fork 397
Propagate IMMUTABLE flag on socket protocol (driver=>upsd); use it in netset; sanity-check if (defaulted) NUMBER values are not in fact STRINGs
#2549
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
base: master
Are you sure you want to change the base?
Conversation
|
Rebased over proposed PR #2552 which covers the noisy but mostly cosmetic changes, to group logical-change commits later in the stack. |
…lag on values in DEBUG builds [networkupstools#266] Signed-off-by: Jim Klimov <[email protected]>
…etworkupstools#266] Signed-off-by: Jim Klimov <[email protected]>
…e as float or long int [networkupstools#266] If we assume a value without flags is by default a NUMBER but is not, re-default it to STRING. If it is also flagged explicitly as a NUMBER but is not, yell a warning for upstream to fix the code. Eventually this should be a reason to report protocol error, but not now. Signed-off-by: Jim Klimov <[email protected]>
…, STRING and NUMBER flags [networkupstools#266] Signed-off-by: Jim Klimov <[email protected]>
…E" flag value [networkupstools#266] Signed-off-by: Jim Klimov <[email protected]>
… reinventing the wheel [networkupstools#266, networkupstools#966] Signed-off-by: Jim Klimov <[email protected]>
…pstools#266] Signed-off-by: Jim Klimov <[email protected]>
…MMUTABLE flag propagation on socket protocol (and fix float=>double) Signed-off-by: Jim Klimov <[email protected]>
…tworkupstools#266] Signed-off-by: Jim Klimov <[email protected]>
…orkupstools#266] Signed-off-by: Jim Klimov <[email protected]>
] Signed-off-by: Jim Klimov <[email protected]>
…rkupstools#266] Signed-off-by: Jim Klimov <[email protected]>
|
Updated with target code base shortly after v2.8.3 release (failed shellchecks) CI host disconnected, no code problems proven yet. Build restarted. |
|
✅ Build nut 2.8.3.3090-master completed (commit 6b875cfd2c by @jimklimov) |
Addresses various sides of issue #266 and should help hunt down cases where we do not provide a
NUMBER/STRINGflag for the readings.Currently this PR does not enforce the
STRING:Ntype but logs messages to that effect to help with further troubleshooting. One problem was about picking theauxvalue (e.g. allowed string length) at a point far away from code that should have defined the variable type in the first place. Another concern is about propagating the guessedSTRINGtype "upwards", so thatnetsetcan set it safely. Although if it lacks any type flag in the first place, most of those checks are (before and still) bypassed and any value should be settable.Possibly the better place for this sanity-checking logic of newly posted data vs. flags of a state entry is in core
state.ccode, to transplant pieces of bothnetset.c::set_var()andnetget.c::get_type()to restrict type usage that should conform to declared flags.Another aspect is bringing
IMMUTABLEflag presence into consideration when trying to set values over NUT protocol (it is not exposed inGET TYPEof the networked protocol to avoid changing the RFC).Screenshot with a driver that has
override.battery.charge=10inups.conf:Currently planning this PR to hang around for reviews and discussion until the next release after an upcoming one; some less questionable changes may be cherry-picked earlier.
This sort of change, or something inspired by it to ensure proper data type mapping with flags (maybe a table based on
docs/nut-names.txtto auto-flag device readings by pattern name? maybe from a loadable file, DMF or parseconf'ed?), would also be useful for efforts like #2525/#2524 which can culminate in reporting of JSON from NUT clients (web or not) -- and then best with a specific reportable schema.