Bug 1441967 - Second attempt to configure agent adds duplicated element to standalone.xml and eap fails to start
Summary: Second attempt to configure agent adds duplicated element to standalone.xml a...
Keywords:
Status: CLOSED UPSTREAM
Alias: None
Product: Middleware Manager
Classification: JBoss
Component: Agent, download agent
Version: unspecified
Hardware: Unspecified
OS: Unspecified
high
high
Target Milestone: CR1
: 7.0.0 TP2
Assignee: John Mazzitelli
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-04-13 08:40 UTC by Filip Brychta
Modified: 2025-02-10 03:49 UTC (History)
2 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2025-02-10 03:49:40 UTC
Embargoed:


Attachments (Terms of Use)

Description Filip Brychta 2017-04-13 08:40:18 UTC
Description of problem:
Second invocation of agent configuration (e.g. in case of incorrect server url) adds duplicated element (<subsystem xmlns="urn:org.hawkular.agent:agent:1.0") and eap fails to start.


Version-Release number of selected component (if applicable):
mm DR04
eap7-middleware-manager-agent-0.29.3-1.Final_redhat_1.1.ep7.el7

How reproducible:
Always

Steps to Reproduce:
1. install EAP 7 (yum groupinstall jboss-eap7)
2. install hawkular wildfly agent (yum install eap7-middleware-manager-agent-0.29.3-1.Final_redhat_1.1.ep7.el7.noarch.rpm)
3. configure the agent:
export JBOSS_HOME=/opt/rh/eap7/root/usr/share/wildfly/
java -jar ${JBOSS_HOME}/bin/hawkular-wildfly-agent-installer.^Cr --target-location=${JBOSS_HOME} --server-url=http://hawkular.bc.jonqe.lab.eng.bos.redhat.com:8080 --username=jdoe --password=password --config-only=true
4. start eap
5. stop eap
6. configure the agent again with different server:
java -jar ${JBOSS_HOME}/bin/hawkular-wildfly-agent-installer.^Cr --target-location=${JBOSS_HOME} --server-url=http://hawkular-new.bc.jonqe.lab.eng.bos.redhat.com:8080 --username=jdoe --password=password --config-only=true
7. start eap

Actual results:
After step 4 everything is ok.
After step 7 the eap fails to start with:
Caused by: javax.xml.stream.XMLStreamException: ParseError at [row,col]:[817,9]
Message: WFLYCTL0069: Duplicate subsystem declaration

The duplicated element is <subsystem xmlns="urn:org.hawkular.agent:agent:1.0"

Expected results:
It should be possible to update agent configuration.

Additional info:

Comment 1 John Mazzitelli 2017-04-13 13:29:02 UTC
You can't run the installer twice on the same server. The installer is meant to install the agent in a server that doesn't have an agent. If it already has an agent, it is not valid to run the installer on it again. The installer isn't meant to update or change an existing agent's configuration. If you run the installer twice on the same server, bad things happen (like this BZ shows).

If you want to update the agent configuration (which is what this BZ wants to do) there are two ways:

1) if the server is running, use the JBoss CLI to do it (to change the server URL like this BZ wants to do, you would modify the "hawkular" outbound server socket binding.)  You will then have to restart the server. Note: if you want to use the CLI and the server is not running, just start the server in admin-only mode, run the CLI, then you can shut the server down again. Something like this:

====
# if the server isn't running yet, start it in admin-only mode
$ standalone.sh --admin-only

# update the agent configuration - here I change the hawkular server URL the agent uses
$jboss-cli.sh --connect '/socket-binding-group=standard-sockets/remote-destination-outbound-socket-binding=hawkular/:write-attribute(name=host,value=your.new.hawkular.server.hostname)'

# You can run additional CLI commands to change any other agent configuration settings you want to update.

# at this point you can shutdown the server and restart it in normal (non-admin-only) mode
====

2) if the server is not running, (and for this BZ is it not running - step 5 shuts it down) just edit standalone.xml's outbound server socket binding element with your new setting. Or, like I mention above, you can start the server in admin-only mode and use the CLI.

Comment 3 John Doyle 2017-04-18 13:31:07 UTC
Is it possible to insert a test for an agent config in the script and if a config is found, exit with a message saying that a configuration exists and modifications should be made through the mgmt APIs?

Comment 4 John Mazzitelli 2017-04-19 01:40:42 UTC
(In reply to John Doyle from comment #3)
> Is it possible to insert a test for an agent config in the script and if a
> config is found, exit with a message saying that a configuration exists and
> modifications should be made through the mgmt APIs?

Yes, we can add a test inside the installer...

  if (agent is already installed) then
    print "The agent is already installed. Installer will abort"
    exit
  end if

Comment 5 John Doyle 2017-04-20 18:00:37 UTC
That would satisfy me.

Comment 6 John Mazzitelli 2017-04-20 18:43:11 UTC
(In reply to John Doyle from comment #5)
> That would satisfy me.

Added JIRA to address this: https://issues.jboss.org/browse/HWKAGENT-168

Comment 7 John Mazzitelli 2017-04-20 20:58:12 UTC
(In reply to John Mazzitelli from comment #6)
> (In reply to John Doyle from comment #5)
> > That would satisfy me.
> 
> Added JIRA to address this: https://issues.jboss.org/browse/HWKAGENT-168

This has been implemented and merged into master:

https://github.com/hawkular/hawkular-agent/pull/324

Comment 11 Red Hat Bugzilla 2025-02-10 03:49:40 UTC
This product has been discontinued or is no longer tracked in Red Hat Bugzilla.


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