Bug 804139

Summary: Bundle deploy error, fails SHA256 check
Product: [Other] RHQ Project Reporter: Mike Foley <mfoley>
Component: ProvisioningAssignee: John Mazzitelli <mazz>
Status: CLOSED CURRENTRELEASE QA Contact: Mike Foley <mfoley>
Severity: medium Docs Contact:
Priority: urgent    
Version: 4.4CC: hrupp, mazz, skondkar
Target Milestone: ---   
Target Release: JON 3.1.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-09-03 11:15:13 EDT Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Bug Depends On:    
Bug Blocks: 782579    
Attachments:
Description Flags
sample bundle
none
server log
none
screenshot of client none

Description Mike Foley 2012-03-16 11:48:29 EDT
Description of problem:  Bundle deploy error, fails SHA256 check


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


How reproducible:
100%


Steps to Reproduce:
1. create group.  i created a group with 1 platform, my linux box
2. basic simple bundle deployment use-case...i am deploying to /home/mfoley/mybundledeploy2
3. deployment fails.  see screenshot.  see server log.  
  
Actual results:


Deployment failed: java.lang.Exception:Package version [PackageVersion[package=Package[name=a.txt,packageType=PackageType[id=10031,name=My Bundle 1297957137903,resourceType=Ant Bundle Handler]],version=1.0,architecture=Architecture: name=[noarch]]] failed SHA256 check. expected=[42144f3939c3ffbbf0bf8b1f12affb5c23a4c5bd41e0ff672d54a5754f062058], actual=[5e7995610bdefd0a9515a92e153f9587a7fdeca216a6c30cbaba0bd0080a698f]



Expected results:

successful deployment

Additional info:

attachments:  sample bundle, server log, screenshot of client
Comment 1 Mike Foley 2012-03-16 11:49:00 EDT
Created attachment 570638 [details]
sample bundle
Comment 2 Mike Foley 2012-03-16 11:49:37 EDT
Created attachment 570639 [details]
server log
Comment 3 Mike Foley 2012-03-16 11:50:06 EDT
Created attachment 570640 [details]
screenshot of client
Comment 4 Mike Foley 2012-03-16 11:51:01 EDT
1st error in server log


2012-03-16 11:42:49,926 WARN  [org.hibernate.util.JDBCExceptionReporter] SQL Error: 1, SQLState: 23000
2012-03-16 11:42:49,926 ERROR [org.hibernate.util.JDBCExceptionReporter] ORA-00001: unique constraint (RHQ.RHQ_BUNDLE_DESTINATION_UNIQUE) violated

2012-03-16 11:42:49,927 ERROR [org.hibernate.event.def.AbstractFlushingEventListener] Could not synchronize database state with
Comment 5 John Mazzitelli 2012-03-23 17:02:22 EDT
the bundle file is called "a.txt" whose content is "a=b".

but when the agent streams it down, the content of the file is "a=btyBlob"

I searched the codebase for "tyBlob" and here's what I find:

     /**
      *  Can be used as initial contents for a PackageVersion's PackageBits whenever a predictable non-null
      *  value is required. Use as an initial value for the PackageBits.blob.bits. The value will
      *  typically be replaced with the actual streamed content bits...<br>
      *  Note: This is a String and not a byte[] because gwt can't handle String.getBytes(). 
      */
     public static final String EMPTY_BLOB = "EmptyBlob";

It seems that:

org.rhq.enterprise.server.content.ContentManagerBean.initializePackageBits(PackageBits)

initializes the content - but if the file content is less than 9 chars, it doesn't clear out the rest!
Comment 6 John Mazzitelli 2012-03-23 17:04:30 EDT
this looks related to bug #611456
Comment 7 John Mazzitelli 2012-03-23 17:31:45 EDT
git commit to master: 0e44e44

please check this against Oracle DB as well as Postgres.

Once you see that this deploys properly, as a final check, DELETE the bundle. (that is, go to the main bundle list view in the GUI, select the test bundle and click the delete button). See that it deletes properly. Again, do this on both Postgres AND Oracle.
Comment 8 Sunil Kondkar 2012-05-15 05:54:31 EDT
Verified on Version: 3.1.0.BETA1 Build Number: 95ef567:68f5518

Uploaded and deployed the attached sample bundle successfully. Also verified that the bundle gets deleted successfully.
Verified on Postgres 8.3.8 and Oracle11G.
Comment 9 Heiko W. Rupp 2013-09-03 11:15:13 EDT
Bulk closing of old issues in VERIFIED state.