-
-
Notifications
You must be signed in to change notification settings - Fork 365
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
Update nutconf
and augeas
lenses with support for NUT keywords added between releases 2.6.5 and 2.8.2
#2425
Conversation
… envvar support Signed-off-by: Jim Klimov <[email protected]>
…isting methods [networkupstools#2294] Signed-off-by: Jim Klimov <[email protected]>
… classes to config files [networkupstools#2294] Signed-off-by: Jim Klimov <[email protected]>
…eclarations Signed-off-by: Jim Klimov <[email protected]>
…tification Signed-off-by: Jim Klimov <[email protected]>
…nutconf/nutconf-cli.cpp: rename nut::UpsmonConfiguration::Monitor::isMaster => isPrimary [networkupstools#840] Signed-off-by: Jim Klimov <[email protected]>
…n to discard double-quotes from content for a fallback comparison Signed-off-by: Jim Klimov <[email protected]>
…ool> with NUT boolean keyword support Signed-off-by: Jim Klimov <[email protected]>
…Ident (for upsd.conf, upsmon.conf...) [networkupstools#2402] Signed-off-by: Jim Klimov <[email protected]>
…Host (for upsmon.conf...) [networkupstools#2402] Signed-off-by: Jim Klimov <[email protected]>
…oduce and unit-test a BoolInt helper class [networkupstools#2402] Signed-off-by: Jim Klimov <[email protected]>
…s with a bool01 toggle (and test it) Allows to enable/disable comparison of bool value to int 0/1 values. Signed-off-by: Jim Klimov <[email protected]>
…s with toString() and << for practical use (and test it) It seems that the assignment operator to string can only be done in the std::string class - a casting operator does not suffice, so the next best things are streaming and explicit methods to emit strings. While at it, also implement assignment into BoolInt objects via << Signed-off-by: Jim Klimov <[email protected]>
Signed-off-by: Jim Klimov <[email protected]>
…es [networkupstools#2294] Signed-off-by: Jim Klimov <[email protected]>
…h BoolInt fields Signed-off-by: Jim Klimov <[email protected]>
networkupstools#2294] Signed-off-by: Jim Klimov <[email protected]>
…on::getFlag() and setFlag() methods [networkupstools#2294] Signed-off-by: Jim Klimov <[email protected]>
…on::getBool() and setBool() method set [networkupstools#2294] Signed-off-by: Jim Klimov <[email protected]>
…on::getBoolInt() and setBoolInt() method set [networkupstools#2294] Signed-off-by: Jim Klimov <[email protected]>
…omatic setBool()/getBool() [networkupstools#2294] Signed-off-by: Jim Klimov <[email protected]>
….*" supportability in UpsConfiguration class [networkupstools#2294] Signed-off-by: Jim Klimov <[email protected]>
… "upsd.conf" keywords introduced between NUT 2.6.5 and 2.8.2 [networkupstools#2294] Signed-off-by: Jim Klimov <[email protected]>
… NutConfigUnitTest::check() with the option to discard double-quotes from content (paths) for a fallback comparison Primarily useful to check this new check() method itself. And because nutwriter.cpp implementation was updated to always use double-quotes for the string values with paths (looking forward to running on MacOS and Windows). Signed-off-by: Jim Klimov <[email protected]>
…nutconf_ut.cpp: handle and test "upsmon.conf" keywords introduced between NUT 2.6.5 and 2.8.2 [networkupstools#2294] Signed-off-by: Jim Klimov <[email protected]>
…nutconf_ut.cpp: handle and test "nut.conf" keywords introduced between NUT 2.6.5 and 2.8.2 [networkupstools#2294] Note that "nut.conf" options follow shell syntax, unlike most other NUT config files Signed-off-by: Jim Klimov <[email protected]>
…nutconf_ut.cpp: handle and test "ups.conf" keywords introduced between NUT 2.6.5 and 2.8.2 [networkupstools#2294] Signed-off-by: Jim Klimov <[email protected]>
…on::getIntHex() and setIntHex() methods [networkupstools#2294] Signed-off-by: Jim Klimov <[email protected]>
…Configuration and test different parsing variants [networkupstools#2294] Signed-off-by: Jim Klimov <[email protected]>
…on::getDouble() and setDouble() methods [networkupstools#2294] Signed-off-by: Jim Klimov <[email protected]>
…etworkupstools#2294] Signed-off-by: Jim Klimov <[email protected]>
…xplicit call to operator via "if (b == true)" [networkupstools#2294] Signed-off-by: Jim Klimov <[email protected]>
…ases [networkupstools#657] Signed-off-by: Jim Klimov <[email protected]>
…that probably should have failed [networkupstools#657] Signed-off-by: Jim Klimov <[email protected]>
… "may be used uninitialized in this function" warnings [networkupstools#2294] Signed-off-by: Jim Klimov <[email protected]>
Signed-off-by: Jim Klimov <[email protected]>
Hmm, this
Wondering if it is not beyond salvation... is there some |
…info> before using typeid [networkupstools#2294] Signed-off-by: Jim Klimov <[email protected]>
Not all systems were created equal... How does augeas decide this, when other regex parsers fail to match the beast to slash. Would escaped
|
…ex [networkupstools#2294] Signed-off-by: Jim Klimov <[email protected]>
Hm... seems the universal augeas parser for handling configs portably is not portable itself as an engine. Same NUT lens and test files fail or pass with different messages, sometimes regardless of augeas versions (one is passing, but older/newer ones fail). |
… override.* expressions [networkupstools#2294] Such possibility makes augtools-1.12.0 upset (fixed since 1.13.0, see hercules-team/augeas#668 for details) Signed-off-by: Jim Klimov <[email protected]>
I guess I'll have to disable the augeas self-test by default again, let the scope of issue #657 deal with it. Was inclined to cut off by release version, but augeas-1.12.0 on Debian and FreeBSD behave differently vs. same NUT test codebase... First will try to separate a "flaky" test with This passes on various linuxes but fails on FreeBSD and OpenBSD workers (used to fail similarly on Ubuntu but then somehow the syntax got wedged to augeas' liking):
|
…e which passes on some distros and fails on others [networkupstools#657] Signed-off-by: Jim Klimov <[email protected]>
…ragmas to hush warnings about macro code [networkupstools#2294] Signed-off-by: Jim Klimov <[email protected]>
…on some distros so far [networkupstools#657] Add make targets for custom testing though Signed-off-by: Jim Klimov <[email protected]>
Yeah, so after all - the quick way forward with this was to keep augeas self-check ability in cold storage as far as regular builds are concerned. It should be a bit more facilitated for developers now though. |
Closes: #2294
Note: per #657 there is more work to improve flexibility of augeas lenses - simple cases should work, but not all combos that NUT own parser supports.
Note: It seems that per initial codebase import (from 2013-ish branch to NUT v2.8.2) the sprawl of C++ header/class/test code is an internal detail of
nutconf
CLI tool - not a library delivered for external consumer linking. As such, there are no concerns currently about API versioning, backwards compatibility, variable/method name changes, etc. which would impact any code not visible from NUT repo itself and its regular builds. This frees up hands for refactoring like this, but eventually it could be useful to document and release the library for NUT configuration management... maybe? Or would the CLI suffice for external integrations?