Bug 858815

Summary: [apache] Agent logs warning "Unable to check for updated configuration" when configuration management is disabled
Product: [Other] RHQ Project Reporter: Larry O'Leary <loleary>
Component: PluginsAssignee: Jay Shaughnessy <jshaughn>
Status: CLOSED CURRENTRELEASE QA Contact: Mike Foley <mfoley>
Severity: low Docs Contact:
Priority: low    
Version: 4.2CC: hrupp, jshaughn
Target Milestone: ---   
Target Release: RHQ 4.10   
Hardware: All   
OS: All   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 858813 Environment:
Last Closed: 2014-04-23 08:29:30 EDT Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---
Bug Depends On:    
Bug Blocks: 858813    

Description Larry O'Leary 2012-09-19 13:48:59 EDT
+++ This bug was initially created as a clone of product Bug #858813 +++

Description of problem:
Even when Augeas support is disabled, the agent reports the following warning for each Apache server and virtual host service in agent inventory:

WARN  [ConfigurationManager.threadpool-1] (rhq.core.pc.configuration.ConfigurationCheckExecutor)- Unable to check for updated configuration


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

How reproducible:
Always

Steps to Reproduce:
1.  Install JON system
    *   Change agent configuration property rhq.agent.plugins.configuration-discovery.period-secs to 120 seconds.
2.  Install and start Apache Web Server (httpd)
3.  Start JON system
4.  Add Apache Web Server to inventory
  
Actual results:
The following warnings appear every at two minute intervals:

2012-09-19 10:40:17,613 INFO  [ConfigurationManager.threadpool-1] (rhq.core.pc.configuration.ConfigurationCheckExecutor)- Starting configuration update check
2012-09-19 10:40:17,618 WARN  [ConfigurationManager.threadpool-1] (rhq.core.pc.configuration.ConfigurationCheckExecutor)- Unable to check for updated configuration
java.lang.IllegalStateException: Configuration and child resource creation/deletion support for Apache is optional. If you switched it on by enabling Augeas support in the connection settings of the Apache server resource and still get this message, it means that either your Apache version is not supported (only Apache 2.x is supported) or Augeas is not available on your platform.
	at org.rhq.plugins.apache.ApacheServerComponent.loadResourceConfiguration(ApacheServerComponent.java:344)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:616)
	at org.rhq.core.pc.inventory.ResourceContainer$ComponentInvocationThread.call(ResourceContainer.java:552)
	at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
	at java.util.concurrent.FutureTask.run(FutureTask.java:166)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
	at java.lang.Thread.run(Thread.java:636)
2012-09-19 10:40:17,619 WARN  [ConfigurationManager.threadpool-1] (rhq.core.pc.configuration.ConfigurationCheckExecutor)- Unable to check for updated configuration
java.lang.IllegalStateException: Configuration and child resource creation/deletion support for Apache is optional. If you switched it on by enabling Augeas support in the connection settings of the Apache server resource and still get this message, it means that either your Apache version is not supported (only Apache 2.x is supported) or Augeas is not available on your platform.
	at org.rhq.plugins.apache.ApacheVirtualHostServiceComponent.loadResourceConfiguration(ApacheVirtualHostServiceComponent.java:158)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:616)
	at org.rhq.core.pc.inventory.ResourceContainer$ComponentInvocationThread.call(ResourceContainer.java:552)
	at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
	at java.util.concurrent.FutureTask.run(FutureTask.java:166)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
	at java.lang.Thread.run(Thread.java:636)
2012-09-19 10:40:17,620 INFO  [ConfigurationManager.threadpool-1] (rhq.core.pc.configuration.ConfigurationCheckExecutor)- Configuration update check completed in 7ms
2012-09-19 10:42:17,613 INFO  [ConfigurationManager.threadpool-1] (rhq.core.pc.configuration.ConfigurationCheckExecutor)- Starting configuration update check
2012-09-19 10:42:17,614 WARN  [ConfigurationManager.threadpool-1] (rhq.core.pc.configuration.ConfigurationCheckExecutor)- Unable to check for updated configuration
java.lang.IllegalStateException: Configuration and child resource creation/deletion support for Apache is optional. If you switched it on by enabling Augeas support in the connection settings of the Apache server resource and still get this message, it means that either your Apache version is not supported (only Apache 2.x is supported) or Augeas is not available on your platform.
	at org.rhq.plugins.apache.ApacheServerComponent.loadResourceConfiguration(ApacheServerComponent.java:344)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:616)
	at org.rhq.core.pc.inventory.ResourceContainer$ComponentInvocationThread.call(ResourceContainer.java:552)
	at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
	at java.util.concurrent.FutureTask.run(FutureTask.java:166)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
	at java.lang.Thread.run(Thread.java:636)
2012-09-19 10:42:17,615 WARN  [ConfigurationManager.threadpool-1] (rhq.core.pc.configuration.ConfigurationCheckExecutor)- Unable to check for updated configuration
java.lang.IllegalStateException: Configuration and child resource creation/deletion support for Apache is optional. If you switched it on by enabling Augeas support in the connection settings of the Apache server resource and still get this message, it means that either your Apache version is not supported (only Apache 2.x is supported) or Augeas is not available on your platform.
	at org.rhq.plugins.apache.ApacheVirtualHostServiceComponent.loadResourceConfiguration(ApacheVirtualHostServiceComponent.java:158)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:616)
	at org.rhq.core.pc.inventory.ResourceContainer$ComponentInvocationThread.call(ResourceContainer.java:552)
	at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
	at java.util.concurrent.FutureTask.run(FutureTask.java:166)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
	at java.lang.Thread.run(Thread.java:636)
2012-09-19 10:42:17,616 INFO  [ConfigurationManager.threadpool-1] (rhq.core.pc.configuration.ConfigurationCheckExecutor)- Configuration update check completed in 3ms


Expected results:
No warning or failure of any kind.

Additional info:
This is happening because the loadResourceConfiguration methods in ApacheServerComponent and ApacheVirtualHostServiceComponent are not implemented to handle a situation when configuration is disabled. Instead, the methods treat isAugeasEnabled = false as an error condition and throw and exception. This should not happen if the user has explicitly disabled Augeas and therefore configuration management for the Apache resource. According to the API doc for ConfigurationFacet.loadResourceConfiguration(), the methods should return null when configuration management is disabled by the plug-in. However, in this case, we are throwing an exception when configuration is disabled.

I think the expected behavior here is to perhaps log a debug message when loadResourceConfiguration is returning null due to isAugeasEnabled returning false without an exception being raised and in cases where isAugeasEnabled throws an exception, we log this as a warning and still return null.
Comment 1 Jay Shaughnessy 2014-02-10 17:39:39 EST
master commit bd8aa47cbe7d0f501efd6879b8928505d15d6a08
Author: Jay Shaughnessy <jshaughn@redhat.com>
Date:   Mon Feb 10 17:37:07 2014 -0500

- Applied Larry's recommended fix. Return null of augeas is disabled as per
  the jdoc of loadResourceConfiguration().
Comment 2 Heiko W. Rupp 2014-04-23 08:29:30 EDT
Bulk closing of 4.10 issues.

If an issue is not solved for you, please open a new BZ (or clone the existing one) with a version designator of 4.10.