Uploading bundle via the CLI results in "[Warning] Subject [test] requires Global CREATE_BUNDLES and VIEW_BUNDLES to create unassigned initial bundle version." error
Environment
- Red Hat JBoss Operations Network (ON) 3.2, 3.3
- creating bundle through CLI
Issue
- How to upload a bundle via the CLI without View Bundle permissions
- Is there a way to upload a Bundle directly to a Bundle Group via the JON CLI, effectively skipping writing it to the Unassigned Bundle Group?
- Receiving error similar to below when creating bundle through CLI:
org.rhq.enterprise.client.script.CLIScriptException: org.rhq.scripting.javascript.engine.util.ExtendedScriptException: org.mozilla.javascript.WrappedException:Wrapped org.rhq.enterprise.server.authz.PermissionException: [Warning] Subject [test] requires Global CREATE_BUNDLES and VIEW_BUNDLES to create unassigned initial bundle version. (<Unknown source>#46) in <Unknown source> at line number 46
at org.rhq.enterprise.client.commands.ScriptCommand.executeScriptFile(ScriptCommand.java:291)
at org.rhq.enterprise.client.commands.ScriptCommand.execute(ScriptCommand.java:93)
at org.rhq.enterprise.client.ClientMain$StartupConfiguration.process(ClientMain.java:163)
at org.rhq.enterprise.client.ClientMain.run(ClientMain.java:188)
at org.rhq.enterprise.client.ClientMain.main(ClientMain.java:172)
Caused by: org.rhq.scripting.javascript.engine.util.ExtendedScriptException: org.mozilla.javascript.WrappedException: Wrapped org.rhq.enterprise.server.authz.permissionException: [Warning] Subject [test] requires Global CREATE_BUNDLES and VIEW_BUNDLES to create unassigned initial bundle version. (<Unknown source>#46) in <Unknown source> at line number 46
Resolution
To create a bundle under a specific bundle group, one of the createInitialBundleVersionVia...() methods of BundleManagerRemote1 should be used. For example, "createInitialBundleVersionViaFile(Subject subject, int[] bundleGroupIds, File distributionFile)" can be used to create a bundle based on a distribution file. Once the initial version is created, the createBundleVersionVia...() can be used to upload new versions of the bundle and it will remain assigned to the existing bundle group.
Note, to upload bundles from remote systems, the createInitialBundleVersionViaByteArray() and createBundleVersionViaByteArray() will need to be used.
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.
Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.
