Bug 1139607
| Summary: | EAP cli script fails always during bundle deployment to domain server | ||||||
|---|---|---|---|---|---|---|---|
| Product: | [JBoss] JBoss Operations Network | Reporter: | Armine Hovsepyan <ahovsepy> | ||||
| Component: | Provisioning | Assignee: | Thomas Segismont <tsegismo> | ||||
| Status: | CLOSED CURRENTRELEASE | QA Contact: | Armine Hovsepyan <ahovsepy> | ||||
| Severity: | high | Docs Contact: | |||||
| Priority: | unspecified | ||||||
| Version: | JON 3.3.0 | CC: | gkhachik, lkrejci, mfoley, tsegismo | ||||
| Target Milestone: | ER03 | ||||||
| Target Release: | JON 3.3.0 | ||||||
| Hardware: | Unspecified | ||||||
| OS: | Unspecified | ||||||
| Whiteboard: | |||||||
| Fixed In Version: | Doc Type: | Bug Fix | |||||
| Doc Text: | Story Points: | --- | |||||
| Clone Of: | Environment: | ||||||
| Last Closed: | 2014-12-11 14:04:02 UTC | Type: | Bug | ||||
| 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: | 1050014 | ||||||
| Attachments: |
|
||||||
|
Description
Armine Hovsepyan
2014-09-09 10:21:52 UTC
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 |