Bug 837449

Summary: Apache httpd VirtualHost ServerName value should be used for resource's name in inventory
Product: [JBoss] JBoss Operations Network Reporter: Larry O'Leary <loleary>
Component: Plugin -- Apache, UsabilityAssignee: Michael Burman <miburman>
Status: CLOSED NEXTRELEASE QA Contact: Sunil Kondkar <skondkar>
Severity: high Docs Contact:
Priority: medium    
Version: JON 3.2.3CC: lkrejci, loleary, mazz, mfoley, miburman, mshirley, myarboro, skondkar, spinder
Target Milestone: ---Keywords: Triaged
Target Release: One-off release   
Hardware: All   
OS: All   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 835312
: 1127874 (view as bug list) Environment:
Last Closed: 2015-04-29 22:20:51 UTC Type: Support Patch
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---
Bug Depends On: 835312    
Bug Blocks: 1127874    
Attachments:
Description Flags
screenshot none

Description Larry O'Leary 2012-07-03 22:52:49 UTC
+++ This bug was initially created as a clone of upstream RHQ Bug #835312 +++

Description of problem:
When importing an Apache httpd virtual host which has a ServerName value which is not resolvable back to an interface on the local machine, the hostname or IP of the local machine is used instead of the ServerName value.  For an httpd instance with multiple virtual hosts with unresolvable ServerName values, this results in virtual host resources that are only identifiable by the port number in the resource name, or by manually inspecting each resource for the ServerName value recorded in the resource key.

Version-Release number of selected component (if applicable):
JON 3.0.1

How reproducible:
Very

Steps to Reproduce:
1. Add virtual host section to httpd.conf with unresolvable ServerName value:
Listen 8080
<VirtualHost *:8080>
        ServerName myunresolvablehost:8080
</VirtualHost>

2. Start httpd instance
3. Run discovery in agent to pick up "myunresolvablehost" ('discovery -f' if httpd instance is already in inventory
4. Navigate to httpd's virtual host children
5. Identify the newly added virtual host resource
  
Actual results:
Resource name is the local machine's hostname or IP address in format "hostname:8080"

Expected results:
Resource name should be referencing the value of the ServerName directive of the virtual host configuration.  For example, "myunresolvablehost:8080".

Comment 1 Larry O'Leary 2012-07-03 22:56:45 UTC
This is a usability issue that makes it difficult to identify a virtual host in the resource list as we do not retain the virtual host name as the resource name in the even the virtual host name is not resolvable. Apache does not require the server name to be resolvable as it is a "virtual" name and not a "logical" name.

The fix for this should be relatively easy with no impact.

Comment 3 Charles Crouch 2012-08-29 16:06:11 UTC
As per 8/20 triage 8/20 pushing to JON312

Comment 6 Michael Burman 2014-08-05 18:20:06 UTC
Fixed in the master. This change does not touch the resourceKey format, only resourceName.

commit 33ce700d3c3d9c657e0d5b98511c178e797e48bb
Author: burmanm <miburman@redhat.com>
Date:   Tue Aug 5 21:17:47 2014 +0300

    [BZ 837449] Change behaviour of apache plugin to select ServerName + VirtualHost combination as first priority for resourceName and fall back to server

Comment 7 John Mazzitelli 2014-08-07 18:37:03 UTC
commit to release/jon3.2.x : bb173ddb263775f7c4dd3abf91ffa2559d425ea6

Comment 8 Simeon Pinder 2014-08-15 03:19:11 UTC
Moving to ON_QA as this is available for test in JON 3.2.3 ER01 build:

http://jon01.mw.lab.eng.bos.redhat.com:8042/dist/release/jon/3.2.3.GA/8-14-14/

Comment 9 Sunil Kondkar 2014-08-19 11:07:29 UTC
Tested on Version : 3.2.0.GA Update 03 Build Number :bca1bc8:e19c43d

Added below virtual host entry to httpd.conf with unresolvable ServerName value:

Listen 8080
<VirtualHost *:8080>
        ServerName myunresolvablehost:8080
</VirtualHost>

- Started httpd instance
- After discovery navigated to httpd's virtual host children
- Observed that he newly added virtual host resource name has the format "<hostname>:8080"
  
Please refer the attached screenshot.

Comment 10 Sunil Kondkar 2014-08-19 11:08:07 UTC
Created attachment 928313 [details]
screenshot

Comment 14 Larry O'Leary 2015-04-29 22:20:51 UTC
This issue was fixed and released in JWS management plug-in for JBoss ON 3.3 per BZ-1127874. Please upgrade to JBoss ON 3.3 to receive this fix.