Bug 612358

Summary: Have to change the archive name in order to upload updated bundle file
Product: [Other] RHQ Project Reporter: Deon Ballard <dlackey>
Component: ProvisioningAssignee: John Mazzitelli <mazz>
Status: CLOSED CURRENTRELEASE QA Contact: Sunil Kondkar <skondkar>
Severity: medium Docs Contact:
Priority: urgent    
Version: unspecifiedCC: mazz
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: 2.4 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2010-08-12 16:45:32 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 601949    
Attachments:
Description Flags
Java exception that I got
none
bundle zip
none
bundle zipped with 100% more zip -r
none
just the prop files, like i upload in the ui none

Description Deon Ballard 2010-07-08 00:34:33 UTC
Created attachment 430206 [details]
Java exception that I got

Description of problem:
I have to change the name of the archive file as well as the version number to upload an updated bundle. Otherwise, I get a java exception relating to rollback.

Version-Release number of selected component (if applicable):
I'm using a build from June 30 and I have a postgres database. The bundle file is very simple; I have a deploy.xml file and a text configuration file that I zip into bundle.zip.

How reproducible:
Always, so far.

Steps to Reproduce:
1. Upload a bundle with an archive named bundle.zip.
2. Edit the deploy.xml file so that the version is 2.0, make a change to the config file, and make a new bundle.zip file.
3. Try to upload the new bundle.
   a. Click New.
   b. Select the recipe radio button and upload the new deploy.xml.
   c. In the files screen (page 2), try to upload bundle.zip.
  
Actual results:
Get the error message "Bundle file upload failed" and a java error.

Expected results:
Should be able to upload the archive just fine.

Comment 1 Deon Ballard 2010-07-08 00:35:43 UTC
Created attachment 430207 [details]
bundle zip

I don't know if it matters, but I'm also attaching my bundle. It doesn't do anything; I just made it up so I could run through the wizard.

Comment 2 Deon Ballard 2010-07-08 16:06:22 UTC
Created attachment 430411 [details]
bundle zipped with 100% more zip -r

Comment 3 John Mazzitelli 2010-07-08 16:16:16 UTC
the deploy.xml has invalid XML - erroneous deployment-unit end tag. 

When uploading just the recipe, don't use <tag/> notation, use <tag></tag> everywhere in the recipe.

Comment 4 Deon Ballard 2010-07-08 16:33:22 UTC
<?xml version="1.0"?>

<project name="myapp" default="main"
         xmlns:rhq="antlib:org.rhq.bundle">

    <rhq:bundle name="Other App" version="1.6"
                description="this is just an example">
<rhq:deployment-unit name="appserver">
<rhq:archive name="bundle.zip">
<rhq:replace>
<rhq:fileset>
<include name="name.properties"></include>
<include name="port.properties"></include>
</rhq:fileset>
</rhq:replace>
</rhq:archive>
</rhq:deployment-unit>
      <rhq:input-property
       name="app.ipaddress"
       description="the IP address"
       required="true"></rhq:input-property>

      <rhq:input-property
       name="http.port"
       description="the HTTP port"
       required="true"
       type="integer"></rhq:input-property>

      <rhq:input-property
       name="https.port"
       description="the HTTPS port"
       required="true"
       type="integer"></rhq:input-property>


    </rhq:bundle>

    <target name="main"></target>

</project>

Comment 5 Deon Ballard 2010-07-08 16:33:56 UTC
Created attachment 430417 [details]
just the prop files, like i upload in the ui

Comment 6 John Mazzitelli 2010-07-08 16:57:56 UTC
This might have something to do with it :)

        HiddenItem versionField = new HiddenItem("version");
        versionField.setValue("1.0");

This is in:

org.rhq.enterprise.gui.coregui.client.components.upload.BundleFileUploadForm

and its always setting the version of the uploaded bundle file to 1.0. We should, instead, always set it to the version of the bundle itself.

        versionField.setValue(this.bundleVersion.getVersion());

Comment 7 John Mazzitelli 2010-07-08 17:11:55 UTC
this is the patch to fix this:

@@ -151,3 +151,3 @@ public class BundleFileUploadForm extends DynamicCallbackForm {
         HiddenItem versionField = new HiddenItem("version");
-        versionField.setValue("1.0");
+        versionField.setValue(this.bundleVersion.getVersion());

Comment 8 John Mazzitelli 2010-07-08 17:16:56 UTC
release-3.0.0 branch commit: 01445ef3c09a6429fb6ce4ba97f64dd2fc60a098

here's the replication steps to test the fix works:

1) Go to Bundle UI and click "New" to create a new bundle (i.e. start the Create Bundle wizard)

2) Select the "upload recipe" radio button

3) Copy the recipe XML text that Deon specified in comment #4 and paste it into the recipe text area

4) Click Next

5) Upload the attached bundle.zip as the bundle file

6) Finish the wizard. This created bundle with version 1.6. Now repeat - Click "New" to start the Create Bundle wizard again

7) Select the "upload recipe" radio button

8) Copy the recipe XML text that Deon specified in comment #4 and paste it into the recipe text area but change it as specified in the next step...

9) Change the bundle version from 1.6 to 2.0

10) Click Next

11) Upload the attached bundle.zip as the bundle file

Step 11 should finish successfully. Finish the wizard and you should have two bundle versions now.

Comment 9 Sunil Kondkar 2010-07-09 08:34:04 UTC
Verified on latest jon 2.4.0.GA_QA build#53

Followed replication steps to test the fix as provided in comment 8.
The bundle.zip is uploaded successfully and displays two bundle versions.

Comment 10 Corey Welton 2010-08-12 16:45:32 UTC
Mass-closure of verified bugs against JON.