Description of problem: EAP cli script fails always during bundle deployment to domain server Version-Release number of selected component (if applicable): JON 3.3 ER02 How reproducible: always Steps to Reproduce: 1. install and start EAP server in domain mode 2. create a bundle containing cli script (containing only ls command) 3. deploy bundle to eap domain server Actual results: deployment fails with handover error Expected results: deployment passes Additional info: operation run for the same script passes on eap domain server
Lukas, I ran Armine's test agent in debug mode and actually the CLI script execution fails with the following error: ============ File /home/hudson/jboss-eap6-domain/data/tmp/prepareDatasource.cli2952106056583414403.tmp doesn't exist. ============ It is a regression introduced after the creation of the ServerControl class. In BaseServerComponent#handleExecuteScript, before: ============== scriptFile = File.createTempFile(handoverRequest.getFilename(), ".tmp", context.getTemporaryDirectory()); FileUtil.writeFile(handoverRequest.getContent(), scriptFile); CliExecutor cliExecutor = new CliExecutor(getMode(), getServerPluginConfiguration(), getStartScriptConfiguration(), context.getSystemInformation()); ProcessExecutionResults results = cliExecutor.executeCliScript(scriptFile.getAbsolutePath(), waitTime, killOnTimeout); ============== Note the "scriptFile.getAbsolutePath()" invocation. After: ============= scriptFile = File.createTempFile(handoverRequest.getFilename(), ".tmp", context.getTemporaryDirectory()); FileUtil.writeFile(handoverRequest.getContent(), scriptFile); ProcessExecutionResults results = CliExecutor.onServer( getServerPluginConfiguration().getPluginConfig(), getMode(), context.getSystemInformation()) .waitingFor(waitTime).killingOnTimeout(killOnTimeout).executeCliScript(scriptFile); ============= and in ServerControl.Cli#executeCliScript: ============= File homeDir = serverPluginConfig.getHomeDir(); File script = scriptFile; if (!script.isAbsolute()) { script = new File(homeDir, scriptFile.getPath()); } ============= Did you introduce the code above to support the execution of CLI scripts defined by relative path in the the server resource operation parameters? I guess all I need to do to fix the bug is to make BaseServerComponent#handleExecuteScript call ServerControl.Cli#executeCliScript with an absolute File object, but I'm not sure I'm not missing something.
+1 Thomas, this seems to be a confusion on my side... the path should of course be absolute because when the file object is created, it is relative to CWD of the agent but then passed as a path to the jboss-cli.sh which has different CWD. I think we should change this as you suggested.
For the reasoning about the relative paths handling in ServerControl: when I was putting together the ServerControl class from the various code snippets around the codebase, this seemed to be the expected behavior - i.e. if the path is relative, resolve it against homeDir. Not sure if that's been the behavior in all the places that are now invoking ServerControl - at least the instance we just discovered wasn't... :(
Fixed in master commit b6795f890782266d4ab23b825cf6ba7356b0fba3 Author: Thomas Segismont <tsegismo> Date: Wed Sep 10 18:46:21 2014 +0200 Bug 1139607 - EAP cli script fails always during bundle deployment to domain server #executeCliScript should be called with an absolute File reference. Side work: * convert script File reference to absolute when the execute-script command is executed * log results of handed-over script's execution * some code cleanup
Cherry-picked over to release/jon3.3.x commit a719cf491840348da929bc41dc309e1f0d4f69f7 Author: Thomas Segismont <tsegismo> Date: Wed Sep 10 18:46:21 2014 +0200 Bug 1139607 - EAP cli script fails always during bundle deployment to domain server #executeCliScript should be called with an absolute File reference. Side work: * convert script File reference to absolute when the execute-script command is executed * log results of handed-over script's execution * some code cleanup (cherry picked from commit b6795f890782266d4ab23b825cf6ba7356b0fba3) Signed-off-by: Thomas Segismont <tsegismo>
Moving to ON_QA as available for test with the following brew build: https://brewweb.devel.redhat.com//buildinfo?buildID=385149
Created attachment 938498 [details] domain_delp
deployment with cli script for domain server works in JON 3.3 ER03 - screenshot attached