Bug 625198 - defaultValue for rhq:input-property element is ignored when used in a bundle recipe
Summary: defaultValue for rhq:input-property element is ignored when used in a bundle ...
Status: CLOSED CURRENTRELEASE
Alias: None
Product: RHQ Project
Classification: Other
Component: Provisioning (Show other bugs)
(Show other bugs)
Version: 3.0.0
Hardware: All All
high
medium vote
Target Milestone: ---
: ---
Assignee: John Mazzitelli
QA Contact: Corey Welton
URL:
Whiteboard:
Keywords:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2010-08-18 20:35 UTC by Larry O'Leary
Modified: 2011-05-24 01:10 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2011-05-24 01:10:08 UTC
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
Screenshot (39.12 KB, image/png)
2011-03-14 09:31 UTC, Sunil Kondkar
no flags Details

Description Larry O'Leary 2010-08-18 20:35:14 UTC
Description of problem:
When defining a default value for a user-provided variable within a bundle's deploy.xml, the default value is not used or appears to be ignored.  This results in the deployment of the bundle failing unless a value was explicitly specified by the user when deploying the bundle.

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

How reproducible:
Always

Steps to Reproduce:
1. Add a new bundle that defines a rhq:input-property with a defaultValue.

<?xml version="1.0"?>
<project name="calculator-bundle" default="main" 
    xmlns:rhq="antlib:org.rhq.bundle">

   <rhq:bundle name="Example Calculator App" version="1.0" description="an example bundle of the Calculator EAR">
      <rhq:input-property
         name="a.user.value"
         description="A user specified value to demonstrate the default value is not used"
         required="true"
         defaultValue="a default value"
         type="string"/>

      <rhq:deployment-unit name="calculator-ear" preinstallTarget="preinstall" postinstallTarget="postinstall">
         <rhq:archive name="ear-calculator.ear"/>
      </rhq:deployment-unit>
   </rhq:bundle>

   <target name="main" />

   <target name="preinstall">
      <echo>Deploying bundle ${rhq.deploy.name} to ${rhq.deploy.dir}...</echo>
      <property name="preinstallTargetExecuted" value="true"/>
   </target>

   <target name="postinstall">
      <echo>Done deploying bundle ${rhq.deploy.name} to ${rhq.deploy.dir}</echo>
      <property name="postinstallTargetExecuted" value="true"/>
   </target>
</project>

2. Once the bundle has been added, deploy it to a group
3. When prompted for a value for a.user.value, leave it blank
  
Actual results:
The deployment of the bundle fails with no evident reason/error

Expected results:
The deployment of the bundle should be successful

Additional info:
I would also expect that the default value would pre-populate the field in the UI.

Comment 1 John Mazzitelli 2010-12-19 23:47:56 UTC
git commits:

2c87326ad0fa9449ef0e351e0f241d36ec4566da
0e90bc94eb626e05b55fd5f2f1a2eeaac7e25c4e

This bug actually shows up in both ant and filetemplate bundle types (the bug description only mentions the ant input-property, but there was no way to set a default value in file template recipes, these commits fix that also).

This was a larger fix that anticipated. It turns out we were never persisting any default template with the config def object. The fix includes this now. The fix was in the core bundle subsystem, so it is supported for any bundle type (ant or file template recipes for now).

If you have any required properties OR properties that define a default value, the configuration definition will get assigned a default template. If a required property does not set a default in the recipe, null will be used.

Comment 2 Sunil Kondkar 2011-03-14 09:31:07 UTC
Verified on build#1090 (Version: 4.0.0-SNAPSHOT Build Number: f19c23e)

Uploaded the bundle that defines a rhq:input-property with defaultValue. While deploying the bundle to a group, observed that on prompting value (for a.user.value), it displayed the default value ("a default value" as defined in recipe). Please refer the attached screenshot.

The bundle got deployed successfully.

Marking the bug as verified.

Comment 3 Sunil Kondkar 2011-03-14 09:31:47 UTC
Created attachment 484112 [details]
Screenshot

Comment 4 Corey Welton 2011-05-24 01:10:08 UTC
Bookkeeping - closing bug - fixed in recent release.


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