First of all i would like to thank the contributing developers for the great command line support in AS7.
I'm currently evaluating the options to provide a configuration mechanism for our projects with the follwing goals in mind:
- encapsulation of environment settings: since most of the developer and operations folks don't know the CLI they should be able to provide the settings (IPs, ports, DB-Connection settings) for the target system in a separate properties file without searching/editing the CLI scripts.
- repeatable: In case of a missconfiguration (e.g. wrong IP or DB-Password provided) the script execution should be repeatable.
- portability: the scripts should work for developer machines (windows, macosx) as well as the test, qa and production environments (linux)
- zero dependencies: since the environments are heterogenous (see above) and especially test, qa and production environments are very restricted (e.g. no curl) there should no need for additional tools or scripting languages.
- maintainability: The ability to use line breaks to improve the readability for long commands would be a great help. This is already adressed by https://issues.jboss.org/browse/AS7-2640
Since i assume that these are advanced but common requirements it would be great if the the CLI would provide two new features to achieve these goals. Below are my suggestions for the corresponding improvements. I would appreciate to get feedback on my suggestions and also concerning the chances of beeing implemented in a (not so far) future release.
1. Encapsulation of environment settings
The CLI should support interpolation of properties provided by properties files and system properties (analogue to the properties support in the domain.sh/standalone.sh scripts)
./jboss-admin.sh --connect --file=some/location/my-script.cli --properties=/some/location/environment.properties
db_url=jdbc:h2:mem:test db_user=sa db_password=sa
2. Repeatable script executions
To allow for repeatable script executions conditional logic is required to prevent "Duplicate resource" failures:
exists = test if the resource to be (re-)added already exists if (exists) remove resource add resource
The conditional logic currently requires a wrapper script which violates either the portability goal (a shell script is sufficient but not portable) or the zero dependencies goal (e.g. requires cygwin to exec the shell script under windows or another portable scripting language).
Adding a force or override attribute to the add operation (which recreates the resources transparently if necessary) would remove the need for conditional logic and additional wrapper scripts/dependencies.
Since the CLI is already portable and has no further dependencies these two new features (plus AS7-2640) would be sufficent to provide a solution for all the initially described goals. It would be great if these enhancements could make their way into AS7.1.0.Final