Bug 681708
Summary: | Add ability to remotely upload bundle distribution file to create bundle through CLI | ||||||
---|---|---|---|---|---|---|---|
Product: | [Other] RHQ Project | Reporter: | Marc Shirley <mshirley> | ||||
Component: | CLI | Assignee: | John Mazzitelli <mazz> | ||||
Status: | CLOSED CURRENTRELEASE | QA Contact: | Mike Foley <mfoley> | ||||
Severity: | medium | Docs Contact: | |||||
Priority: | high | ||||||
Version: | 3.0.0 | CC: | hrupp, mazz | ||||
Target Milestone: | --- | ||||||
Target Release: | --- | ||||||
Hardware: | All | ||||||
OS: | All | ||||||
Whiteboard: | |||||||
Fixed In Version: | Doc Type: | Bug Fix | |||||
Doc Text: | Story Points: | --- | |||||
Clone Of: | Environment: | ||||||
Last Closed: | 2013-08-31 10:47:31 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: | 734807 | ||||||
Attachments: |
|
Description
Marc Shirley
2011-03-02 23:10:35 UTC
for a quick and dirty implementation (that supports bundle distro files that aren't too large such that they fit in memory), just duplicate: org.rhq.enterprise.server.bundle.BundleManagerRemote.createBundleVersionViaFile(Subject, File) where the File is, instead, a byte[]. This would be exposed to the CLI and the CLI script could just slurp the content in memory and send it over the wire. This should be simple to do, but of course has the limitation of requiring the distro file to be loaded in memory. Probably not a problem for small-to-medium sized bundles. Once you start getting in the hundreds of MBs, then you are going to probably hit issues. If you do hit problems you can always increase the Xmx setting used to start the CLI with, that maybe a workaround for some issues. git commit 3787402 new remote API: public BundleVersion createBundleVersionViaByteArray(Subject subject, byte[] fileBytes) throws Exception as the javadoc warns, if you have very large files, this requires them to be loaded in memory which could cause OutOfMemoryErrors in either the CLI OR the RHQ Server. Added BZ https://bugzilla.redhat.com/show_bug.cgi?id=741993 while attempting to verify this BZ. explicitly requiring Subject in the signature is inconsistent with the rest of the remote API. no other signatures in the remote API have Subject in the signature. it is inconsistent. For example: BundleManager.createBundleVersionViaFile(distributionFile); //does not require Subject ... why should createBundleVersionViaByteArray?? Signature is passed automatically. Reference Documentation: http://www.rhq-project.org/display/JOPR2/Running+the+RHQ+CLI#RunningtheRHQCLI-Examples [Subject] Represents the current, logged in user. For security purposes, all remote service invocations require the subject to be passed; however, the CLI will implicitly pass the subject for you. The API will be more usable if it is consistent. Consider removing Subject from the signature. disregard above comment. i got it now. if i leave the argument out ... everything works. Documenting the CLI script I wrote to verify this: var bundleName = 'mikesbundle2'; var bundleDistroV1Path = '/home/mfoley/exampleBundles/bundle1.zip'; // delete the test bundle if it exists var bc = new BundleCriteria(); print("Bundle Criteria Created\n") bc.addFilterName(bundleName); print("Bundle filter created\n") var bundles = BundleManager.findBundlesByCriteria(bc); if (null != bundles && bundles.size() > 0 ) { print("\nDeleting [" + bundleName + "] to re-run sample scripts...") BundleManager.deleteBundle(bundles.get(0).getId()); } // create bundleVersion 1.0 for the sample bundle var distributionFile = new java.io.File(bundleDistroV1Path); distributionFile = new java.io.File(distributionFile.getAbsolutePath()); Assert.assertTrue(distributionFile.exists(), "Missing ant bundle distribution file: " + distributionFile); theBytes = new Array(); theBytes = org.rhq.core.util.stream.StreamUtil.slurp(new java.io.FileInputStream(distributionFile)); var bundleVersion1 = BundleManager.createBundleVersionViaByteArray(theBytes); print("\nCreated " + bundleVersion1 + "!") //now verify in the UI the bundle was created uploading the sample Bundle I used in verification Created attachment 525810 [details]
sample bundle used in verification
verified, as documented above added BZ https://bugzilla.redhat.com/show_bug.cgi?id=742617 on a negative test with empty byte array. |