Bug 1038728 - The agent's config export command produces an invalid XML file
The agent's config export command produces an invalid XML file
Status: CLOSED CURRENTRELEASE
Product: JBoss Operations Network
Classification: JBoss
Component: Agent (Show other bugs)
JON 3.1.2
Unspecified Unspecified
medium Severity low
: ER01
: JON 3.2.3
Assigned To: Michael Burman
Mike Foley
: Triaged
Depends On: 782915
Blocks: 1127873
  Show dependency treegraph
 
Reported: 2013-12-05 11:53 EST by Larry O'Leary
Modified: 2014-09-05 11:40 EDT (History)
5 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 782915
: 1127873 (view as bug list)
Environment:
Last Closed: 2014-09-05 11:40:30 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:


Attachments (Terms of Use)


External Trackers
Tracker ID Priority Status Summary Last Updated
Red Hat Knowledge Base (Solution) 137893 None None None Never

  None (edit)
Description Larry O'Leary 2013-12-05 11:53:37 EST
Description of problem:
The agent's config export command produces an invalid XML file.

Bug 536138 introduced a change that results the DOCTYPE element being removed and no DTD being defined. This means that a config export from the agent produces a file that can not be imported back into the agent:

Failed to start the agent
java.lang.IllegalArgumentException: Failed to load configuration file [/tmp/00989956-agent-configuration-export.xml]. Cause: java.util.prefs.InvalidPreferencesFormatException: org.xml.sax.SAXParseException; lineNumber: 2; columnNumber: 41; Document root element "preferences", must match DOCTYPE root "null".
	at org.rhq.enterprise.agent.AgentMain.processArguments(AgentMain.java:3155)
	at org.rhq.enterprise.agent.AgentMain.<init>(AgentMain.java:508)
	at org.rhq.enterprise.agent.AgentMain.main(AgentMain.java:404)


Version-Release number of selected component (if applicable):
3.1.2.GA

How reproducible:
Always

Steps to Reproduce:
1.  Install and configure JBoss ON agent.
2.  Launch agent command prompt:

        ${RHQ_AGENT_HOME}/bin/rhq-agent.sh -n
        
3.  Execute agent config export prompt command:

        config export /tmp/exported-agent-configuration.xml
        
4.  Exit agent command prompt.
5.  Re-configure agent using export configuration:

        ${RHQ_AGENT_HOME}/bin/rhq-agent.sh --cleanconfig --config /tmp/exported-agent-configuration.xml

6.  Validate /tmp/exported-agent-configuration.xml:

        xmllint --valid /tmp/exported-agent-configuration.xml


Actual results:
Agent fails to start:

    Failed to start the agent
    java.lang.IllegalArgumentException: Failed to load configuration file [/tmp/00989956-agent-configuration-export.xml]. Cause: java.util.prefs.InvalidPreferencesFormatException: org.xml.sax.SAXParseException; lineNumber: 2; columnNumber: 41; Document root element "preferences", must match DOCTYPE root "null".
        at org.rhq.enterprise.agent.AgentMain.processArguments(AgentMain.java:3155)
        at org.rhq.enterprise.agent.AgentMain.<init>(AgentMain.java:508)
        at org.rhq.enterprise.agent.AgentMain.main(AgentMain.java:404)


xmllint reports:

    /tmp/exported-agent-configuration.xml:2: validity error : Validation failed: no DTD found !
    <preferences EXTERNAL_XML_VERSION="1.0">
                                           ^


Expected results:
Exported agent configuration file can be imported without error or validation warning.

Additional info:
As indicated in Bug 782915, this issue is a direct result of the work done in Bug 536138.
Comment 1 John Mazzitelli 2013-12-05 12:15:52 EST
see bug #536138 and bug #782915 for some history on this issue.
Comment 2 John Mazzitelli 2013-12-05 12:17:23 EST
HA! I didn't realize Larry alread mentioned those bugs from my last comment in his description - guess I should read the whole thing all the way through.
Comment 5 Michael Burman 2014-07-11 12:03:22 EDT
Fixed in master (includes unit test):

commit d6c14baa1bc2f4b8e63045abe10bf4d62878708c
Author: burmanm <miburman@redhat.com>
Date:   Fri Jul 11 19:00:06 2014 +0300
Comment 8 John Mazzitelli 2014-08-07 14:38:37 EDT
commit to release/jon3.2.x : fcc34701d5977e59f0c1d87366df9fd3438fb00c
Comment 9 Simeon Pinder 2014-08-14 23:19:06 EDT
Moving to ON_QA as this is available for test in JON 3.2.3 ER01 build:

http://jon01.mw.lab.eng.bos.redhat.com:8042/dist/release/jon/3.2.3.GA/8-14-14/

Note You need to log in before you can comment on or make changes to this bug.