Skip to content

NMS-10432: Dead configuration cleanup - #9008

Open
joseanesONMS wants to merge 5 commits into
developfrom
jira/NMS-10432-config-cleanup-smoke
Open

joseanesONMS wants to merge 5 commits into
developfrom
jira/NMS-10432-config-cleanup-smoke

Conversation

@joseanesONMS

@joseanesONMS joseanesONMS commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Removes dead configuration from shipped config files and the installer. Nothing a running system uses changes.

Ticket What was removed or changed Proof it was unused Upgrade impact
NMS-10432 etc/examples/threshd-configuration.xml and its WillItUnmarshalIT entry No reference in assemblies, spec, debian, installer, docs or code besides that IT entry None; etc/examples is never loaded
NMS-5264 Default users.xml no longer ships <mstation>; users.xsd makes it optional and documents it as deprecated and ignored; JAXB Header no longer marks it required Only the Header getter/setter touch it; UserManager writes back the header it read Old users.xml with <mstation> still validates (checked with xmllint) and keeps its value
NMS-10535 config-tester: database-schema.xml entry, beans and test; dead snmpConfigDao bean; stale mapsadapter-configuration.xml test ignore; the filters reference page no longer places database-schema.xml in etc database-schema.xml is loaded from the jar since HZN-1308; FactoryBasedSnmpConfigDao no longer exists; every other mapped file still ships None; the tester ignores files outside its map
NMS-9877 libraries.properties is written without the Properties.store() date comment, otherwise byte-identical, and is not written at all when its content would not change Readers are Bootstrap, Installer and an opennms.spec grep of opennms.library.* lines install -dis leaves an unchanged file untouched, modification time included, and no longer logs "Could not create file" on re-runs

Verification: config-model and config-tester unit tests (including ConfigTester -a over the default etc) and the installer tests pass on current develop; the old users.xml with <mstation> validates against the new XSD.

External References

The example only duplicated the shipped etc/threshd-configuration.xml with
long-gone services (JBoss32, JBoss4) and nothing reads it: git grep finds no
reference in assemblies, packaging (spec, debian), installer, docs or code.
The only user was the EXAMPLE entry in WillItUnmarshalIT, removed here.

The examples directory is copied as a whole, so no assembly descriptor
changes. Customer copies of the file under etc/examples are never loaded.
Nothing reads the users.xml header mstation value: git grep finds only the
JAXB getter/setter in config.users.Header, whose callers (UserManager) just
carry the header through a save unchanged, plus test fixtures.

users.xsd keeps the element as optional and documents it as deprecated, so
existing users.xml files that still contain it keep validating through
@ValidateUsing; the Java property stays for the same reason. A header
without it is marshalled without the element.
…gone

Every config file in the config-tester map still ships in etc on develop (vacuumd-configuration.xml included), except database-schema.xml, which has been loaded from the opennms-config jar since HZN-1308; its map entry, its two beans and its test go, and `config-tester database-schema.xml` now reports an unknown config name.
Two other leftovers go: the lazy, never referenced snmpConfigDao bean, whose class FactoryBasedSnmpConfigDao no longer exists, and the ConfigTesterTest ignore entry for mapsadapter-configuration.xml, which is no longer shipped (git grep finds it only in the ConfigFileConstants id table and opennms.spec filters).

The tester never looks at files outside its map, so customer etc directories that still hold these files are unaffected.
Properties.store() always writes a "#<date>" first line, so every install
run rewrote etc/libraries.properties even when the library paths were
unchanged. The installer now stores to a buffer and drops that first line,
keeping the rest byte for byte (ISO-8859-1, same escaping and order), and
closes the stream it previously leaked.

Readers only load the file as Properties (Bootstrap, Installer) or grep for
opennms.library.* lines (opennms.spec); nothing reads the comment.

@marshallmassengill marshallmassengill left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is good but wait for another review before merging. I don't see any issues with what's included here.

@cgorantla cgorantla left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. The PR says install -dis "no longer rewrites the file". That is not quite right: the content stays the same, but the file is still rewritten and its modification time changes. Either correct the wording in the PR description or skip the write when the content has not changed.
  2. testStoreWithoutTimestampKeepsPropertiesFormat builds its expected value with the same logic as the code it tests. The first test already covers the behaviour, so this is a weak test rather than a wrong one.
  3. filters.adoc:8 says database-schema.xml is in /opt/opennms/etc, which is wrong. The PR did not cause this, but it is a cheap docs fix.

Comment on lines 1224 to 1226
if(!f.createNewFile()) {
LOG.warn("Could not create file: {}", f.getPath());
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Could not create file" warning in Installer.java:1224 now logs on every re-run, because the file already exists. Remove the createNewFile() check, since FileOutputStream creates the file anyway.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed in c1232cd; Files.write creates the file when it is missing.

…hanged

install -dis now compares the formatted properties with the existing file
and leaves it, including its modification time, untouched when they match.
The createNewFile() check is gone: it warned on every re-run because the
file already exists, and Files.write creates it when it does not.

The format test now asserts literal expected output instead of rebuilding
it with the code under test, and a new test checks the modification time.
The filters reference page no longer says database-schema.xml is in etc;
it has been loaded from the opennms-config jar since HZN-1308.
@github-actions github-actions Bot added the docs label Oct 23, 2026
@github-actions
github-actions Bot requested a review from indigo423 October 23, 2026 12:28
@joseanesONMS

Copy link
Copy Markdown
Contributor Author

@cgorantla Addressed in c1232cd:

  1. install -dis now skips the write when the content is unchanged, so the file and its modification time stay untouched; the description is updated to match.
  2. The format test now asserts literal expected output, and a new test sets an old modification time and checks that an unchanged re-run keeps it and a changed path rewrites the file.
  3. filters.adoc no longer says database-schema.xml is in /opt/opennms/etc; it notes the file ships inside the opennms-config library.

The failing integration-test job (EventconfFactoryIT, JDK 25 XML entity limit) also fails on develop 47b1c71 itself, so it is not from this PR.

@marshallmassengill marshallmassengill left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like the feedback was all addressed.

@marshallmassengill marshallmassengill left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is ok but wait for @cgorantla to review changes from feedback.

This branch has not been deployed

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants