Bug 564543

Summary: Tomcat plugin: "Script Prefix" does not work
Product: [Other] RHQ Project Reporter: Ondřej Žižka <ozizka>
Component: PluginsAssignee: Stefan Negrea <snegrea>
Status: CLOSED CURRENTRELEASE QA Contact: Mike Foley <mfoley>
Severity: medium Docs Contact:
Priority: medium    
Version: 1.3CC: cwelton, jshaughn, skondkar, snegrea
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-09-02 07:26:44 UTC Type: ---
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: 683054, 565628    

Description Ondřej Žižka 2010-02-13 05:12:40 UTC
StR:

1) Install and launch Tomcat 5.5.28, set up in JON.
2) Go to it's INVENTORY > CONNECTION
3) Set Script Prefix == FOO=x (a valid sh prefix)
4) Perform the shutdown operation. You'll get:
   FileNotFoundException: The program to execute [FOO=x] does not exist

Either I didn't understand what the Script Prefix is for, then please document it better, or this is a bug.


------------------------------------

java.lang.RuntimeException: Script returned error or non-zero exit code while shutting down the Tomcat instance. Exit code [null]
	at org.jboss.on.plugins.tomcat.TomcatServerOperationsDelegate.doShutdown(TomcatServerOperationsDelegate.java:315)
	at org.jboss.on.plugins.tomcat.TomcatServerOperationsDelegate.shutdown(TomcatServerOperationsDelegate.java:278)
	at org.jboss.on.plugins.tomcat.TomcatServerOperationsDelegate.shutdown(TomcatServerOperationsDelegate.java:274)
	at org.jboss.on.plugins.tomcat.TomcatServerOperationsDelegate.invoke(TomcatServerOperationsDelegate.java:128)
	at org.jboss.on.plugins.tomcat.TomcatServerComponent.invokeOperation(TomcatServerComponent.java:420)
	at sun.reflect.GeneratedMethodAccessor1873.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:585)
	at org.rhq.core.pc.inventory.ResourceContainer$ComponentInvocationThread.call(ResourceContainer.java:525)
	at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:269)
	at java.util.concurrent.FutureTask.run(FutureTask.java:123)
	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:651)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:676)
	at java.lang.Thread.run(Thread.java:595)
Caused by: java.io.FileNotFoundException: The program to execute [FOO=x] does not exist
	at org.rhq.core.util.exec.ProcessExecutor.getFullProgramExecutablePath(ProcessExecutor.java:378)
	at org.rhq.core.util.exec.ProcessExecutor.getCommandLine(ProcessExecutor.java:427)
	at org.rhq.core.util.exec.ProcessExecutor.startProgram(ProcessExecutor.java:86)
	at org.rhq.core.util.exec.ProcessExecutor.execute(ProcessExecutor.java:62)
	at org.rhq.core.system.JavaSystemInfo.executeProcess(JavaSystemInfo.java:197)
	at org.rhq.core.system.NativeSystemInfo.executeProcess(NativeSystemInfo.java:243)
	at org.jboss.on.plugins.tomcat.TomcatServerOperationsDelegate.doShutdown(TomcatServerOperationsDelegate.java:304)
	... 13 more

Comment 1 wes hayutin 2010-02-16 16:58:51 UTC
Temporarily adding the keyword "SubBug" so we can be sure we have accounted for all the bugs.

keyword:
new = Tracking + FutureFeature + SubBug

Comment 2 wes hayutin 2010-02-16 17:03:36 UTC
making sure we're not missing any bugs in rhq_triage

Comment 4 Charles Crouch 2011-03-08 13:13:15 UTC
Needs to be reproduced to see if it is still a problem

Comment 5 Ondřej Žižka 2011-03-16 00:29:54 UTC
Still the same:

Caused by: java.io.FileNotFoundException: The program to execute [BAR=x] does not exist

Comment 6 Stefan Negrea 2011-10-14 20:17:22 UTC
The current implementation expects the full path of an executable program in the Script Prefix. The code will then attempt to execute "prefix-script tomcat-script" as one unit. 

The use case mentioned above (Bar=x) is not valid because commands are executed through Runtime.exec (which does not execute scripting constructors from system dependent shell environments).

The recommendation is to clarify further the description for Script Prefix.

Comment 7 Stefan Negrea 2011-10-14 20:39:00 UTC
Updated the Script Prefix description to further clarify the concept. The description was updated for Tomcat, JBoss As4, and JBoss AS5 plugins.

Old description for Script Prefix:
"A prefix applied to script execution commands. Typically a sudo for applicable platforms. The prefix is applied verbatim. As such, a sudo user must be configured appropriately. Ignored if not set."

New description for Script Prefix:
"A prefix applied to script execution commands; this prefix is applied verbatim. The full path of the executable is required (e.g. /usr/bin/sudo). For applicable platforms, this is typically a sudo command, so a sudo user must be configured appropriately for the specified command. Ignored if not set."

Comment 8 Sunil Kondkar 2011-10-17 10:21:19 UTC
Verified on build#540 (Version: 4.1.0-SNAPSHOT Build Number: 1919b71)

The Script Prefix description at Inventory->Connection Settings->Operations displays below:

"A prefix applied to script execution commands; this prefix is applied verbatim. The full path of the executable is required (e.g. /usr/bin/sudo). For applicable platforms, this is typically a sudo command, so a sudo user must be configured appropriately for the specified command. Ignored if not set."

Verified for Tomcat5.5.28, JBoss As4, and JBoss AS5.

Marking as verified.

Comment 9 Heiko W. Rupp 2013-09-02 07:26:44 UTC
Bulk closing of issues that were VERIFIED, had no target release and where the status changed more than a year ago.