Skip to content

Support NUT config subdirs - #3784

Open
jimklimov wants to merge 10 commits into
networkupstools:masterfrom
jimklimov:feat/config-subdirs
Open

jimklimov wants to merge 10 commits into
networkupstools:masterfrom
jimklimov:feat/config-subdirs

Conversation

@jimklimov

@jimklimov jimklimov commented Oct 19, 2026 •

Copy link
Copy Markdown
Member

Closes: #2230

Add support for configuration sub-directory as well as file support for NUT configuration files: ups.conf, upsd.conf, upsd.users, upsmon.conf, upssched.conf, CGI hosts.conf, upsset.conf, etc., except nutauth.conf which already has direct INCLUDE and INCLUDE_REQUIRES keywords.

Implemented support for additional configuration file discovery as <confpath>/<conffile>.d/*.conf (also .../*.users for upsd.users.d) processed in alphanumeric order by upsd, drivers and upsdrvctl (via common parseconf/upsconf code), vanilla clients, and nut-driver-enumerator script. This should allow to rename unneeded files out of the way (*.bak) or move them into a subdirectory. Outputs of e.g. nut-scanner may be directly redirected into a file (maybe a file per bus, as suggested in #2230), without careful stitching of global and device settings in an editor and copy-paste/append workflows. Likewise for integration into systems like HA, unraid, TrueNAS, etc. which can simplify their configuration generators.

  • NOTE: This PR also updates C++ (nutconf) and augeas lens code to automate config management.

Any additional file restarts population of the root context, adding or replacing global configuration remembered there from earlier parsing, while sub-sections must be defined once (subsequent duplicate sections are ignored with a warning log).

Co-authored by IntelliJ Junie / Claude.

@github-actions

github-actions Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

A ZIP file with standard source tarball and another tarball with pre-built docs for commit de0f2e3 is temporarily available: NUT-tarballs-PR-3784.zip.

Comment thread clients/cgilib.c Dismissed
Comment thread clients/upsmon.c Dismissed
Comment thread clients/upssched.c Dismissed
Comment thread clients/upsset.c Dismissed
Comment thread clients/upsstats.c Dismissed
Comment thread common/upsconf.c Dismissed
Comment thread server/conf.c Dismissed
Comment thread server/user.c Dismissed
Comment thread tests/parseconf-test.c Fixed
Comment thread common/parseconf.c Dismissed
@jimklimov jimklimov added enhancement service/daemon start/stop General subject for starting and stopping NUT daemons (drivers, server, monitor); also BG/FG/Debug labels Oct 19, 2026
@jimklimov jimklimov added this to the 2.8.6 milestone Oct 19, 2026
jimklimov added a commit to jimklimov/nut that referenced this pull request Oct 19, 2026
… - do not merge section data [networkupstools#2230, networkupstools#3784]

Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
jimklimov added a commit to jimklimov/nut that referenced this pull request Oct 19, 2026
…ls#3784]

xcalloc() should fail on its own, but CodeQL insists...

Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
jimklimov added a commit to jimklimov/nut that referenced this pull request Oct 19, 2026
jimklimov added a commit to jimklimov/nut that referenced this pull request Oct 19, 2026
…tyle and use `NUT_PATH_MAX` [networkupstools#3784]

Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
jimklimov added a commit to jimklimov/nut that referenced this pull request Oct 19, 2026
…bles to `[NUT_PATH_MAX+1]` to accomodate final NUL [networkupstools#3784]

Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
@jimklimov
jimklimov force-pushed the feat/config-subdirs branch from 3ba8b88 to a19364e Compare October 19, 2026 15:55
@github-actions github-actions Bot deleted a comment from AppVeyorBot Oct 19, 2026
@github-actions github-actions Bot deleted a comment from AppVeyorBot Oct 19, 2026
jimklimov added a commit to jimklimov/nut that referenced this pull request Oct 19, 2026
…tyle and use `NUT_PATH_MAX` [networkupstools#3784]

Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
jimklimov added a commit to jimklimov/nut that referenced this pull request Oct 19, 2026
…bles to `[NUT_PATH_MAX+1]` to accomodate final NUL [networkupstools#3784]

Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
@jimklimov
jimklimov force-pushed the feat/config-subdirs branch from a19364e to 7358d77 Compare October 19, 2026 16:31
@github-actions github-actions Bot deleted a comment from AppVeyorBot Oct 19, 2026
@github-actions github-actions Bot deleted a comment from AppVeyorBot Oct 19, 2026
@jimklimov jimklimov added AI For good or bad, machine tools are upon us. Humans are still the responsible ones. nut-driver-enumerator (NDE) nut-driver-enumerator (NDE) automates service management integration for NUT driver instances etc. labels Oct 19, 2026
@jimklimov
jimklimov requested a review from aquette October 19, 2026 20:08
@github-project-automation github-project-automation Bot moved this to In Progress in SmartNUT Oct 19, 2026
jimklimov added a commit to jimklimov/nut that referenced this pull request Oct 19, 2026
… - C++ and augeas lenses [networkupstools#2230, networkupstools#3784]

Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
@github-actions github-actions Bot deleted a comment from AppVeyorBot Oct 19, 2026
@jimklimov jimklimov added C++ nutconf NUT configuration library and tool augeas Configuration file parser (reader, writer) multi-tool for scripting, etc. labels Oct 19, 2026
… - C++ and augeas lenses [networkupstools#2230, networkupstools#3784]

Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
…ls#3784]

xcalloc() should fail on its own, but CodeQL insists...

Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
…tyle and use `NUT_PATH_MAX` [networkupstools#3784]

Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
…bles to `[NUT_PATH_MAX+1]` to accomodate final NUL [networkupstools#3784]

Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
@jimklimov
jimklimov force-pushed the feat/config-subdirs branch from 15fbeb9 to 0635286 Compare October 20, 2026 00:35
@github-actions github-actions Bot deleted a comment from AppVeyorBot Oct 20, 2026
@jimklimov

Copy link
Copy Markdown
Member Author

Offloaded brewed unrelated CI test fixes into #3786 to minimize the diff relevant to this PR.

@github-actions github-actions Bot deleted a comment from AppVeyorBot Oct 23, 2026
@github-actions github-actions Bot deleted a comment from AppVeyorBot Oct 23, 2026
@github-actions github-actions Bot deleted a comment from AppVeyorBot Oct 26, 2026
@AppVeyorBot

Copy link
Copy Markdown

@AppVeyorBot

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AI For good or bad, machine tools are upon us. Humans are still the responsible ones. augeas Configuration file parser (reader, writer) multi-tool for scripting, etc. C++ enhancement nut-driver-enumerator (NDE) nut-driver-enumerator (NDE) automates service management integration for NUT driver instances etc. nutconf NUT configuration library and tool service/daemon start/stop General subject for starting and stopping NUT daemons (drivers, server, monitor); also BG/FG/Debug

Projects

Status: In Progress

Development

Successfully merging this pull request may close these issues.

Add support for ups.conf.d

3 participants