Bug 1377601 - Controlling Apache using custom script from JBoss ON UI
Summary: Controlling Apache using custom script from JBoss ON UI
Keywords:
Status: CLOSED EOL
Alias: None
Product: JBoss Web Server 3
Classification: Retired
Component: JON Plugin
Version: 3.0.0
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
: ---
Assignee: Jean-frederic Clere
QA Contact: Michal Karm Babacek
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-09-20 08:11 UTC by bkramer
Modified: 2020-03-27 19:46 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2020-03-27 19:46:26 UTC


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Knowledge Base (Solution) 665973 0 None None None 2016-09-20 08:12:48 UTC

Description bkramer 2016-09-20 08:11:50 UTC
Description of problem:

An attempt to run service script or custom script from JBoss ON UI to control Apache (by setting "Control script path") fails. According to the code in the rhq/source/modules/plugins/apache/src/main/java/org/rhq/plugins/apache/ApacheServerOperationsDelegate.java, everything is hardcoded and parameters -d, -f and -k are always added which is the reason why the actual command run by the agent looks like: 

... -d /etc/httpd -f /etc/httpd/conf/httpd.conf -k restart


So, the only way to work around this is to use a wrapper script that will ignore all arguments except the last one (-k) and then run the script with sudo while passing the last argument (start, stop,...) to it.


Version-Release number of selected component (if applicable):
Apache 2.4

How reproducible:
Always

Steps to Reproduce:
1. 
2.
3.

Actual results:
Apache instance cannot be controlled using custom script as additional parameters are added by default. 

Expected results:
Apache instance is properly controlled using custom script.

Additional info:

To workaround this create a wrapper script that strips all the arguments except the last one and set it as the "Control Script Path" for the Apache resource (on the Connection Settings page).

For example, the following script will check for the "-k" parameter and send its value (start, stop,...) to the service httpd command:

***********************************************
#!/bin/bash

while [ "$1" != "-k" ] && [ ! $# -eq 1 ]; do
  shift
done

if [ $# -lt 2 ]; then
  echo "Parameter -k not found?" >&2
  exit 2
fi

/usr/bin/sudo /sbin/service httpd $2
exit $?
***********************************************

Comment 1 Michal Karm Babacek 2016-09-21 11:39:10 UTC
@bkramer, please, file a JWS JIRA.  JWS 3 is no longer maintained in Bugzilla.


Note You need to log in before you can comment on or make changes to this bug.