Bugzilla will be upgraded to version 5.0 on a still to be determined date in the near future. The original upgrade date has been delayed.
Bug 1503826 - Bundle deployment using deployment handover action fails to properly replace/upgrade existing deployment if deployment runtime-name is not the same as deployment name
Bundle deployment using deployment handover action fails to properly replace/...
Status: CLOSED CURRENTRELEASE
Product: JBoss Operations Network
Classification: JBoss
Component: Provisioning, Plugin -- JBoss EAP 6 (Show other bugs)
JON 3.3.9
Unspecified Unspecified
medium Severity medium
: CR01
: One-off release
Assigned To: Ruben Vargas Palma
Mike Foley
https://access.redhat.com/discussions...
: Triaged
Depends On:
Blocks: 1387292
  Show dependency treegraph
 
Reported: 2017-10-18 16:46 EDT by Larry O'Leary
Modified: 2018-02-16 05:02 EST (History)
3 users (show)

See Also:
Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1504148 (view as bug list)
Environment:
Last Closed: 2018-02-16 05:02:16 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)


External Trackers
Tracker ID Priority Status Summary Last Updated
Red Hat Knowledge Base (Solution) 3219291 None None None 2017-10-18 17:33 EDT

  None (edit)
Description Larry O'Leary 2017-10-18 16:46:44 EDT
Description of problem:
If a deployment already exists and an attempt is made to upgrade the deployment using a JBoss ON Provisioning Bundle, the deployment of the bundle fails if the runtime-name used is different than the deployment name. For example, if you deploy helloworld.war using a runtime-name of helloworld and then attempt to deploy helloworld.war version 2 using the handover action from a JBoss ON Bundle to deploy version 2 of the WAR using a runtime-name of helloworld, the bundle will fail to deploy due to JBAS014807: Management resource '[("deployment" => "helloworld")]' not found, rolled-back=true.

Version-Release number of selected component (if applicable):
3.3.8

How reproducible:
Always

Steps to Reproduce:
. Install, configure and start JBoss ON 3.3.8 system.
. Install, configure and start JBoss EAP 6.4.10 standalone server.
. Import EAP standalone server into JBoss ON inventory.
. Configure imported EAP server's connection settings and administrator credentials.
. Create 2 versions of jboss-kitchensink-ear quickstart archive:
+
[source,bash]
.Shell commands to create v1 and v2 of jboss-eap-quickstarts kitchensink-ear:
----
git clone https://github.com/jboss-developer/jboss-eap-quickstarts.git
cd jboss-eap-quickstarts
git checkout 6.4.0.GA
cd kitchensink-ear
mvn -s ../settings.xml package
_tmpdir="$(mktemp -d)"
cp ear/target/jboss-kitchensink-ear.ear "${_tmpdir}/"
mkdir "${_tmpdir}/jboss-kitchensink-ear-v1"
mkdir "${_tmpdir}/jboss-kitchensink-ear-v2"
cp -a "${_tmpdir}/jboss-kitchensink-ear.ear" "${_tmpdir}/jboss-kitchensink-ear-v1/"
cp -a "${_tmpdir}/jboss-kitchensink-ear.ear" "${_tmpdir}/jboss-kitchensink-ear-v2/"
echo "version=1.0" >"${_tmpdir}/ear-version.txt"
(cd ${_tmpdir} && zip "${_tmpdir}/jboss-kitchensink-ear-v1/jboss-kitchensink-ear.ear" ear-version.txt)
echo "version=2.0" >"${_tmpdir}/ear-version.txt"
(cd ${_tmpdir} && zip "${_tmpdir}/jboss-kitchensink-ear-v2/jboss-kitchensink-ear.ear" ear-version.txt)
cp -r "${_tmpdir}/jboss-kitchensink-ear-v1" /tmp/
cp -r "${_tmpdir}/jboss-kitchensink-ear-v2" /tmp/
[ -n "${_tmpdir}" ] && rm -rf "${_tmpdir}"
----
. Create jboss-kitchensink-ear-bundle archive using v2 of _jboss-kitchensink-ear.ear_:
+
[source,bash]
.Shell commands to create v2 of jboss-kitchensink-ear-bundle:
----
_tmpdir="$(mktemp -d)"
cat >"${_tmpdir}/deploy.xml" <<EOF
<?xml version="1.0"?>
<project name="JBoss EAP Quickstarts - kitchensink-ear"
         default="main"
         xmlns:rhq="antlib:org.rhq.bundle">
  <target name="main" />

  <rhq:bundle name="kitchensink-ear" version="2.0" description="An example JBoss ON Provisioning Bundle to deploy the kitchensink-ear from the JBoss EAP Quickstarts project.">
  <rhq:input-property name="kitchensink-ear.runtime.name" defaultValue="jboss-kitchensink-ear.ear" required="false"/>
  <rhq:input-property name="kitchensink-ear.serverGroup.name" defaultValue="main" required="false"/>
    <rhq:deployment-unit name="kitchensink-ear deployment" compliance="filesAndDirectories">
      <rhq:archive name="jboss-kitchensink-ear.ear">
        <rhq:handover action="deployment">
          <rhq:handover-param name="runtimeName" value="\${kitchensink-ear.runtime.name}"/>
          <rhq:handover-param name="serverGroup" value="\${kitchensink-ear.serverGroup.name}"/>
        </rhq:handover>
      </rhq:archive>                         
    </rhq:deployment-unit>
  </rhq:bundle>
</project>
EOF
cp -a /tmp/jboss-kitchensink-ear-v2/jboss-kitchensink-ear.ear "${_tmpdir}"
(cd "${_tmpdir}" && zip /tmp/jboss-kitchensink-ear-bundle-v2.zip deploy.xml jboss-kitchensink-ear.ear)
[ -n "${_tmpdir}" ] && rm -rf "${_tmpdir}"
----
. From EAP server resource's Child Resources Inventory page, create a new child Deployment using `/tmp/jboss-kitchensink-ear-v1/jboss-kitchensink-ear.ear` with a Runtime Name of `kitchensink-ear`:
+
* *Package Version:* `1.0`
* *Upload Resource Content File:* _/tmp/jboss-kitchensink-ear-v1/jboss-kitchensink-ear.ear_
* *Runtime Name:* `kitchensink-ear`
. Create new compatible resource group named `EAP Servers`:
+
* *Name:* `EAP Servers`
* *Members:* _EAP 6 standalone server resource_
. Add bundle _jboss-kitchensink-ear-bundle-v2.zip_ to the JBoss ON system from the Bundles > Bundle Creation Wizard.
. Deploy bundle version 2 to _EAP Servers_ resource group using a runtime name of `kitchensink-ear`:
+
* *Destination Name:* `EAP Server Deployment`
* *Resource Group:* _EAP Servers_
* *Base Location:* _Base directory_
* *Deployment Directory:* `jboss-kitchensink-ear-bundle`
* *Deployment Version:* _2.0_
* *kitchensink-ear.runtime.name:* `kitchensink-ear`

Actual results:
JBAS014807: Management resource '[("deployment" => "kitchensink-ear")]' not found, rolled-back=true

.Bundle Deployment Resource Status:
----
Action  : Handover
Info    : Handover failed during execution
Message : JBAS014807: Management resource '[("deployment" => "kitchensink-ear")]' not found, rolled-back=true
Details : BundleHandoverRequest[filename='jboss-kitchensink-ear.ear', action='deployment', params={runtimeName=kitchensink-ear, serverGroup=main}, context=BundleHandoverContext[revert=false]]
----

.agent.log:
----
ERROR [ResourceContainer.invoker.nonDaemon-27] (org.rhq.plugins.ant.AntBundlePluginComponent)- Failed to deploy bundle [class org.rhq.core.pluginapi.bundle.BundleDeployRequest: deployment=[BundleResourceDeployment: bdd=[BundleDeployment[id=10032, name=Deployment [1] of Version [2.0] to [EAP Server Deployment]]], resource=[Resource[id=10003, uuid=bc6ceac1-c552-483b-b508-80a8c6531f7c, type={JBossAS7}JBossAS7 Standalone Server, key=hostConfig: /data/jboss-eap-6.4.10.GA/standalone/configuration/standalone-full.xml, name=EAP (0.0.0.0:9990), version=EAP 6.4.10.GA]]], target=[file:/opt/jboss/eap/jboss-eap-6.4.10.GA/standalone/jboss-kitchensink-ear-bundle/], clean=[false], revert=[false]]
java.lang.Exception: Failed to execute the bundle Ant script
	at org.rhq.plugins.ant.AntBundlePluginComponent.deployBundle(AntBundlePluginComponent.java:168)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:606)
	at org.rhq.core.pc.inventory.ResourceContainer$ComponentInvocation.call(ResourceContainer.java:759)
	at java.util.concurrent.FutureTask.run(FutureTask.java:262)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
	at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.RuntimeException: Failed to execute bundle deploy file [/opt/jboss/on/rhq-agent/data/tmp/bundle-versions/10031/ant-bundle-recipe6378304032647916610.xml]. Cause: /opt/jboss/on/rhq-agent/data/tmp/bundle-versions/10031/ant-bundle-recipe6378304032647916610.xml:7: Failed to deploy bundle [kitchensink-ear] version [2.0]: java.lang.Exception: Handover failed: Handover[action='deployment', handoverParams=[antlib:org.rhq.bundle:handover-param [name='runtimeName', value='kitchensink-ear'], antlib:org.rhq.bundle:handover-param [name='serverGroup', value='main']], failOnError=true]
	at org.rhq.bundle.ant.AntLauncher.executeBundleDeployFile(AntLauncher.java:154)
	at org.rhq.plugins.ant.AntBundlePluginComponent.executeDeploymentPhase(AntBundlePluginComponent.java:324)
	at org.rhq.plugins.ant.AntBundlePluginComponent.deployBundle(AntBundlePluginComponent.java:148)
	... 9 more
Caused by: /opt/jboss/on/rhq-agent/data/tmp/bundle-versions/10031/ant-bundle-recipe6378304032647916610.xml:7: Failed to deploy bundle [kitchensink-ear] version [2.0]: java.lang.Exception: Handover failed: Handover[action='deployment', handoverParams=[antlib:org.rhq.bundle:handover-param [name='runtimeName', value='kitchensink-ear'], antlib:org.rhq.bundle:handover-param [name='serverGroup', value='main']], failOnError=true]
	at org.rhq.bundle.ant.type.DeploymentUnitType.install(DeploymentUnitType.java:300)
	at org.rhq.bundle.ant.type.DeploymentUnitType.upgrade(DeploymentUnitType.java:532)
	at org.rhq.bundle.ant.task.BundleTask.execute(BundleTask.java:168)
	at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:606)
	at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
	at org.apache.tools.ant.Task.perform(Task.java:348)
	at org.apache.tools.ant.Target.execute(Target.java:390)
	at org.apache.tools.ant.helper.ProjectHelper2.parse(ProjectHelper2.java:179)
	at org.apache.tools.ant.ProjectHelper.configureProject(ProjectHelper.java:80)
	at org.rhq.bundle.ant.AntLauncher.executeBundleDeployFile(AntLauncher.java:150)
	... 11 more
Caused by: java.lang.Exception: Handover failed: Handover[action='deployment', handoverParams=[antlib:org.rhq.bundle:handover-param [name='runtimeName', value='kitchensink-ear'], antlib:org.rhq.bundle:handover-param [name='serverGroup', value='main']], failOnError=true]
	at org.rhq.bundle.ant.type.DeploymentUnitType.install(DeploymentUnitType.java:274)
	... 24 more
----


Expected results:
Version 2 of jboss-kitchensink-ear.ear with runtime-name kitchensink-ear should be deployed and bundle deployment should report success. Version 1 of jboss-kitchensink-ear.ear should no longer be deployed as it was replaced by version 2.

Additional info:
It appears that the runtime-name is being misused as the deployment name during some check.

If the runtime-name matches the deployment name for both version 1 and version 2, no error occurs. However, if the runtime-name for version 1 is different then the deployment name but version 2 uses the same runtime-name as the deployment name, a duplicate resource error is returned. It seems that runtime-name is not being used properly to check to see if the deployment may already exist in order to determine if a replace should be performed.
Comment 1 Ruben Vargas Palma 2017-11-01 23:32:27 EDT
I have a PR for this BZ: https://github.com/rhq-project/rhq/pull/336
Comment 4 Filip Brychta 2017-11-21 06:16:14 EST
Following is working:
- using default runtime name in both versions
- using non-default runtime name but the same for both versions
- using non-default in version 1 and default in version 2
- using default in version 1 and non-default in version 2

Hit this EAP jira during testing - https://issues.jboss.org/browse/JBEAP-13814

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