DeviceConfig via Minion fails if sshScript output contains control characters

Description

Running from a Core \*without\* disableIOCollection true is generally successful. However, when performing device config backup via Minion with either supported message broker while logging ssh script output (which is required for any debugging to be possible), DCB will fail.

 

dcb-trigger in Karaf will timeout (on Kafka):

or spit out a partial exception (with ActiveMQ):

 

The full exception is logged to ipc.log(for kafka):

Or for ActiveMQ:

 

It appears there needs to be additional sanitization of the script output before building the IPC message so that it can be unmarshalled correctly on the receiving side. Disabling script output via org.opennms.features.deviceconfig.sshscripting.disableIOCollection trueis a hamstrung solution that leaves users unable to test and troubleshoot DCB scripts.

Acceptance / Success Criteria

None

Activity

Show:

Chandra Gorantla November 12, 2024 at 4:54 PM

Start with XmlHandler marshalling and unmarshalling. Try below example from David. See if upgrading eclipseLink version helps.

David Schlenk May 31, 2023 at 10:14 PM

I did some googling and it looks like technically an XML parser should replace either of 
 or 
 in an attribute value with a single line break, so what I’ve seen done in other places where it’s useful to preserve control characters is to send them with a backslash instead of an ampersand and omit the semicolon, so an attribute that is currently sent as scriptOutput="&xd;&xa;ogvlab-rtr1" would instead be scriptOutput="\#xd\#xa". I also tried to make plain woodstox barf and wasn’t able to with a default config of a BasicStreamReader, so maybe simply upgrading the 2013 version of eclipse persistence would help but maybe that’s some weird Karaf thing, I don’t know.

In any event thanks and I’m sorry I find all the worst bugs

Done

Details

Assignee

Reporter

Labels

HB Grooming Date

HB Backlog Status

Components

Sprint

Affects versions

Priority

PagerDuty

Created May 31, 2023 at 8:55 PM
Updated February 10, 2025 at 1:54 PM
Resolved January 15, 2025 at 2:45 PM