summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Negrea <snegrea@redhat.com>2012-09-21 17:53:46 (GMT)
committerStefan Negrea <snegrea@redhat.com>2012-09-21 17:54:17 (GMT)
commit7f0fd6111408fbe4fb6643e7646cb86d679d37ec (patch)
treee3de1e58737d9e637460e8127b295a015daa215f
parent965b08b1e2f8a16f33206001d8f8ac19d0bec51b (diff)
downloadrhq-7f0fd6111408fbe4fb6643e7646cb86d679d37ec.zip
rhq-7f0fd6111408fbe4fb6643e7646cb86d679d37ec.tar.gz
rhq-7f0fd6111408fbe4fb6643e7646cb86d679d37ec.tar.xz
[BZ 859512] Execute :read-resource if whoami fails to correctly detect the server state. :whoami exists for the majority of the resources, the only exceptions are resources that do not have the security context established by AS7.
-rw-r--r--modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/BaseComponent.java8
1 files changed, 8 insertions, 0 deletions
diff --git a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/BaseComponent.java b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/BaseComponent.java
index a4e99b4..080c60f 100644
--- a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/BaseComponent.java
+++ b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/BaseComponent.java
@@ -280,6 +280,14 @@ public class BaseComponent<T extends ResourceComponent<?>> implements AS7Compone
// Read server state
Operation op = new Operation("whoami", getAddress());
Result res = getASConnection().execute(op);
+
+ //:whoami might fail host controller resources, in that case use :read-resource operation
+ //which is slower due to larger content returned but more reliable since every resource has it.
+ if (!res.isSuccess()) {
+ op = new Operation("read-resource", getAddress());
+ res = getASConnection().execute(op);
+ }
+
if (res.isReloadRequired()) {
PropertySimple oobMessage = new PropertySimple("__OOB","The server needs a reload for the latest changes to come effective.");
configuration.put(oobMessage);