modules/core/plugin-container/src/main/java/org/rhq/core/pc/util/DiscoveryComponentProxyFactory.java
| 2
modules/enterprise/agent/src/main/java/org/rhq/enterprise/agent/PluginUpdate.java
| 7 -
modules/plugins/augeas/src/main/java/org/rhq/plugins/augeas/AugeasConfigurationComponent.java
| 41 ++++++----
modules/plugins/samba/src/main/java/org/rhq/plugins/samba/SambaShareDiscoveryComponent.java
| 18 ++--
4 files changed, 41 insertions(+), 27 deletions(-)
New commits:
commit 59fa8941390850b6bb0d3f5380963592ed25e0e2
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Sat Jun 29 13:33:40 2013 +0200
If we got an interrupted exception, there is no point of showing the stacktrace.
diff --git
a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/util/DiscoveryComponentProxyFactory.java
b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/util/DiscoveryComponentProxyFactory.java
index c160b78..ac465a6 100644
---
a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/util/DiscoveryComponentProxyFactory.java
+++
b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/util/DiscoveryComponentProxyFactory.java
@@ -223,7 +223,7 @@ public class DiscoveryComponentProxyFactory {
log.debug("Thread [" + Thread.currentThread().getName() +
"] was interrupted.");
}
future.cancel(true); // this is a daemon thread, let's try to cancel
it
- throw new RuntimeException(invokedMethodString(method, args, "was
interrupted."), e);
+ throw new RuntimeException(invokedMethodString(method, args, "was
interrupted."));
} catch (ExecutionException e) {
if (log.isDebugEnabled()) {
log.debug(invokedMethodString(method, args, "failed."),
e);
commit 2b75b3367e0303916dce653869c8af6f69638694
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Sat Jun 29 13:23:05 2013 +0200
BZ 725736 If no augeas just return null. Also prevent other meaningless stacktraces
when Augeas is not present.
diff --git
a/modules/plugins/augeas/src/main/java/org/rhq/plugins/augeas/AugeasConfigurationComponent.java
b/modules/plugins/augeas/src/main/java/org/rhq/plugins/augeas/AugeasConfigurationComponent.java
index 5976ad8..63a5cd2 100644
---
a/modules/plugins/augeas/src/main/java/org/rhq/plugins/augeas/AugeasConfigurationComponent.java
+++
b/modules/plugins/augeas/src/main/java/org/rhq/plugins/augeas/AugeasConfigurationComponent.java
@@ -138,6 +138,14 @@ public class AugeasConfigurationComponent<T extends
ResourceComponent<?>> implem
}
public Configuration loadResourceConfiguration() throws Exception {
+
+ if (!isAugeasAvailable()) {
+ if (log.isDebugEnabled()) {
+ log.debug("Can not load configuration as Augeas is not
available");
+ }
+ return null;
+ }
+
abortIfAugeasNotAvailable();
//augeas was initialized in abortIfAugeasNotAvailable();
@@ -346,7 +354,7 @@ public class AugeasConfigurationComponent<T extends
ResourceComponent<?>> implem
/**
* Returns initialized augeas instance. Augeas instance must be closed by calling
method close on the Augeas instance
- * or by calling method close on AugeasConfigurationComponent instance after use of
augeas.
+ * or by calling method close on AugeasConfigurationComponent instance after use of
augeas.
* @return
*/
public Augeas getAugeas() {
@@ -378,9 +386,13 @@ public class AugeasConfigurationComponent<T extends
ResourceComponent<?>> implem
augeas = new Augeas(this.augeasRootPath, augeasLoadPath,
Augeas.NO_MODL_AUTOLOAD);
setupAugeasModules(augeas);
checkModuleErrors(augeas);
- } catch (RuntimeException e) {
+ } catch (Throwable e) {
augeas = null;
- log.error("Failed to initialize Augeas Java API.", e);
+ String msg = "Failed to initialize Augeas Java API: " +
e.getMessage();
+ if (e instanceof NoClassDefFoundError) {
+ msg += " - there is probably no native library available";
+ }
+ log.warn(msg);
}
return augeas;
}
@@ -719,18 +731,19 @@ public class AugeasConfigurationComponent<T extends
ResourceComponent<?>> implem
this.augeas = null;
}
this.augeas = createAugeas();
- this.augeas.load();
- checkModuleErrors(this.augeas);
- String resourceConfigRootPath = getResourceConfigurationRootPath();
- if (resourceConfigRootPath.indexOf(AugeasNode.SEPARATOR_CHAR) != 0) {
- // root path is relative - make it absolute
- this.resourceConfigRootNode = new AugeasNode("/files/",
resourceConfigRootPath);
- } else {
- // root path is already absolute
- this.resourceConfigRootNode = new AugeasNode(resourceConfigRootPath);
+ if (augeas!=null) {
+ this.augeas.load();
+ checkModuleErrors(this.augeas);
+ String resourceConfigRootPath = getResourceConfigurationRootPath();
+ if (resourceConfigRootPath.indexOf(AugeasNode.SEPARATOR_CHAR) != 0) {
+ // root path is relative - make it absolute
+ this.resourceConfigRootNode = new AugeasNode("/files/",
resourceConfigRootPath);
+ } else {
+ // root path is already absolute
+ this.resourceConfigRootNode = new AugeasNode(resourceConfigRootPath);
+ }
+ log.debug("Resource Config Root Node = \"" +
this.resourceConfigRootNode + "\"");
}
- log.debug("Resource Config Root Node = \"" +
this.resourceConfigRootNode + "\"");
-
}
private void abortIfAugeasNotAvailable() throws Exception {
diff --git
a/modules/plugins/samba/src/main/java/org/rhq/plugins/samba/SambaShareDiscoveryComponent.java
b/modules/plugins/samba/src/main/java/org/rhq/plugins/samba/SambaShareDiscoveryComponent.java
index 34809b7..402cbfd 100644
---
a/modules/plugins/samba/src/main/java/org/rhq/plugins/samba/SambaShareDiscoveryComponent.java
+++
b/modules/plugins/samba/src/main/java/org/rhq/plugins/samba/SambaShareDiscoveryComponent.java
@@ -45,14 +45,16 @@ public class SambaShareDiscoveryComponent implements
ResourceDiscoveryComponent<
try {
augeas = serverComponent.getAugeas();
- List<String> matches =
augeas.match("/files/etc/samba/smb.conf/target[. != 'global']");
- for (String match : matches) {
- String name = augeas.get(match);
- Configuration pluginConfig =
discoveryContext.getDefaultPluginConfiguration();
- pluginConfig.put(new PropertySimple("targetName", name));
- DiscoveredResourceDetails detail = new
DiscoveredResourceDetails(discoveryContext.getResourceType(),
- name, name + " share", null, "Samba Share [" +
name + "]", pluginConfig, null);
- details.add(detail);
+ if (augeas!=null) {
+ List<String> matches =
augeas.match("/files/etc/samba/smb.conf/target[. != 'global']");
+ for (String match : matches) {
+ String name = augeas.get(match);
+ Configuration pluginConfig =
discoveryContext.getDefaultPluginConfiguration();
+ pluginConfig.put(new PropertySimple("targetName", name));
+ DiscoveredResourceDetails detail = new
DiscoveredResourceDetails(discoveryContext.getResourceType(),
+ name, name + " share", null, "Samba Share ["
+ name + "]", pluginConfig, null);
+ details.add(detail);
+ }
}
return details;
commit 5cd5fad909985f184ef3728d11c35b81573fadfd
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Fri Jun 28 17:17:04 2013 +0200
BZ 960936 - the plugin name already contains the directory. Don't add it again.
diff --git
a/modules/enterprise/agent/src/main/java/org/rhq/enterprise/agent/PluginUpdate.java
b/modules/enterprise/agent/src/main/java/org/rhq/enterprise/agent/PluginUpdate.java
index bf2fef0..8aa81a0 100644
--- a/modules/enterprise/agent/src/main/java/org/rhq/enterprise/agent/PluginUpdate.java
+++ b/modules/enterprise/agent/src/main/java/org/rhq/enterprise/agent/PluginUpdate.java
@@ -278,9 +278,9 @@ public class PluginUpdate {
* of streaming the plugin, the download will fail. When this happens, this method
will simply
* attempt to download the plugin again (this time, hopefully, we will remain
connected to the
* new server and the download will succeed).
- *
+ *
* @param plugin the plugin to download
- *
+ *
* @throws Exception if, despite our best efforts, the plugin could not be
downloaded
*/
private void downloadPluginWithRetries(Plugin plugin) throws Exception {
@@ -446,9 +446,8 @@ public class PluginUpdate {
if (!latest_plugins_map.containsKey(current_plugin.getPath())) {
File plugin = getPluginFile(current_plugin);
if (plugin.exists()) {
- File plugin_dir = this.config.getPluginDirectory();
String plugin_filename = plugin.getPath();
- File plugin_backup = new File(plugin_dir, plugin_filename +
".REJECTED");
+ File plugin_backup = new File(plugin_filename +
".REJECTED");
LOG.warn(AgentI18NResourceKeys.PLUGIN_NOT_ON_SERVER, plugin_filename,
plugin_backup.getName());
try {
plugin_backup.delete(); // in case an old backup is for some
reason still here, get rid of it