This means that the httpd executable will always use the default server root (the one hard-coded in the httpd binary) and the default config file (SERVER_ROOT/conf/httpd.conf), rather than the server root and config file defined in the Resource's plugin configuration. So when those values are not the same as the default values, either the operation will fail or the wrong Apache instance will be started or stopped...
Created attachment 433755 [details] proposed patch This patch ensures that the -d <server-root> -f <conf-file> is always passed to the control script.
Created attachment 433758 [details] corrected patch I created the first patch off of wrong revisions.. This should be the correct version
I've reviewed Lukas's patch, and it looks good.
Dropping priority since this appears to have a workaround
commit f188170f3196544902cf6d19a02cb0e8d6ac8309 Author: Lukas Krejci <lkrejci> Date: Thu Jul 22 18:26:30 2010 +0200 BZ 617218 - always passing in the -d <serverroot> -f <conf-file> as parameters to the apache control script so that a correct instance is acted upon.
Tested on JON 2.4.1 (build #23) build number: 10957:f188170 Observation: Apache start, stop, restart, restart gracefully, operations from UI working fine. Lukas, Can you please provide steps to test the bug?
Repro Steps: 1) Copy the default apache configuration from /etc/httpd somewhere else and make some modifications so that you can identify that server (for example change the Listen port to some other value) 2) Start that apache instance by executing: httpd -d <the-new-location> -f <httpd.conf-in-the-new-location> -k start 3) Let RHQ discover this instance and inventory it 4) On that inventoried instance, issue all of its operations and check that the operations executed using the correct configuration files (i.e. in the above example, the server is going to listen on the port specified in the new-location configuration) Also, a slightly more complicated scenario should be tested: 1) Have some config in the default /etc/httpd 2) Copy it to some new location 3) In the new location, change the ServerRoot to point to yet another location In that case, the configuration specified in the yet-another-location should be used by the server and loaded by the plugin.
Tested on JON 2.4.1 (build #23) build number: 10957:f188170 Steps: 1) Copy the default apache configuration from /etc/httpd somewhere else and make some modifications so that you can identify that server (for example change the Listen port to some other value) 2) Start that apache instance by executing: httpd -d <the-new-location> -f <httpd.conf-in-the-new-location> -k start 3) Let RHQ discover this instance and inventory it 4) On that inventoried instance, issue all of its operations and check that the operations executed using the correct configuration files (i.e. in the above example, the server is going to listen on the port specified in the new-location configuration) Observation: Operations executed with its appropriate configuration files. Still other scenario need to be tested.
Verified the second scenario on Build #23 (jon241-release/23) 1) Default config is at /etc/httpd 2) Copied it to new location /NotBackedUp/newapache/httpd.conf 3) In the new location, changed the ServerRoot in config file to point to yet another location --/NotBackedUp 4) In the new location, specified Listen:81 and "Include conf.d/*.conf" 5) Added a configuration file at the location defined as ServerRoot in conf file (at /NotBackedup/conf.d/test.conf) 6) Added ServerName and ServerAdmin directives in /NotBackedup/conf.d/test.conf Observed that the configuration specified in the yet-another-location is loaded by the plugin. The ServerAdmin and ServerName are displayed as defined in /NotBackedup/conf.d/test.conf Also did some operations like start, stop, restart, restart gracefully on apache resource from UI. These operations are successful and executed using the correct configuration file. (/NotBackedUp/newapache/httpd.conf )
Bookkeeping - closing bug - fixed in recent release.