Description of problem: CLI samples ... usability issue with drift.js Version-Release number of selected component (if applicable): JON 3.01 RC#1 How reproducible: 100% Drift.js (and the other samples) are really not usable out of the box. A gap exists before the .js files can be used. The scripts contain utility functions, but they are not runnable. There should be some kind of wrapper that allows these to be utility functions to run. Eliminating or reducing these barriers will help the customer experience, increase adoption, etc ..
12/30/2012 BZ triage meeting mfoley, ccrouch, loleary, asantos
The proper solution is to implement the import mechanism that the scripts could use. I.e. something akin to http://requirejs.org (note that this is not that simple, because ideally, the mechanism should work both in the CLI proper and in the serverside CLI alert scripts - but requirejs has a pluggable script loader mechanism, so maybe we would be able to hook it up on the serverside with the scripts stored in RHQ repos). A workaround might be to add ability to load multiple script files using the -f commandline option. This however would not be so user friendly anyway, because the user would need to know the requirements of the scripts upfront and specify them in the -f option in a specific order.
Given Lukas' comment this is not going to be resolvable in 3.0.1. Resetting for *consideration* as part JON3.1.0.
Discussion of our options for implementing the script modularity: http://rhq-project.org/display/RHQ/Script+Modularity
This is an action/enhancement requested by QE to make testing easier. The support for modular/includes in the CLI appears to have been implemented in upstream bug 852145. Resetting for triage in 3.2.0. Hopefully something useful will happen once we realize that this is already available upstream and just needs to be brought into the product.
In RHQ 4.6 codebase (or maybe already in RHQ 4.5.1 actually), the following has been done: 1) The scripts in the "samples" directory in the CLI distribution were left intact. 2) A new subdirectory called "modules" was added under "samples", which contains the "modularized" versions of the scripts in samples. 3) The modularized version of drift.js can be loaded in the CLI by issuing the following command: var drift = require("modules:/drift") 4) The functions from the drift.js file are then available through the "drift" variable in the example above. Note that the the location from where the "modules:/..." scripts are loaded is configurable and defaults to $CLI_HOME/samples/modules. It can be changed by passing a different path using "rhq.scripting.modules.root-dir" system property. I.e. starting the CLI like: RHQ_CLI_ADDITIONAL_JAVA_OPTS="-Drhq.scripting.modules.root-dir=<ABS_PATH>" $CLI_HOME/bin/rhq-cli.sh will set the base path from where the modules are loaded (using the "modules:/" path prefix) to the <ABS_PATH> (no code change here, so setting the status to ON_QA straight away)
As this is MODIFIED or ON_QA, setting milestone to ER1.
verified unconnected$ var drift = require("modules:/drift") unconnected$ drift. createSnapshot diff fetchHistory unconnected$ drift.