modules/enterprise/server/server-control/src/main/java/org/rhq/server/control/RHQControl.java
| 45 ++++++++++
1 file changed, 45 insertions(+)
New commits:
commit 15939eb445646f905f65fff2a054364a08524d0a
Author: Simeon Pinder <spinder(a)fulliautomatix.conchfritter.com>
Date: Mon Dec 9 17:17:43 2013 -0500
BZ 1039664 - one more udpate to logged warning to refer to documentation.
diff --git
a/modules/enterprise/server/server-control/src/main/java/org/rhq/server/control/RHQControl.java
b/modules/enterprise/server/server-control/src/main/java/org/rhq/server/control/RHQControl.java
index 8f6d0b0..24e4995 100644
---
a/modules/enterprise/server/server-control/src/main/java/org/rhq/server/control/RHQControl.java
+++
b/modules/enterprise/server/server-control/src/main/java/org/rhq/server/control/RHQControl.java
@@ -140,7 +140,8 @@ public class RHQControl {
// but there are no other rpms other than the agent, so if we see
this jboss-on-* location, we know the agent is here.
log.warn("An agent RPM installation was found in ["
+ jonDir
- + "]!!! You will not be able to successfully run this older
agent anymore. You should manually remove it.");
+ + "]!!! You will not be able to successfully run this older
agent anymore. You should consult the "
+ +"install documentation about manually removing and/or
merging the old and new agent.");
return true;
} else {
return false;
commit dbf6b06ce0934efdf23eaa9b9db5d7b0bf078f47
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Mon Dec 9 12:49:46 2013 -0500
BZ 1039664 - log warning if jon agent rpm is detected
(cherry picked from commit e4c0b12f83c3d51f111591e7fc7773125e655e17)
diff --git
a/modules/enterprise/server/server-control/src/main/java/org/rhq/server/control/RHQControl.java
b/modules/enterprise/server/server-control/src/main/java/org/rhq/server/control/RHQControl.java
index e4c27f8..8f6d0b0 100644
---
a/modules/enterprise/server/server-control/src/main/java/org/rhq/server/control/RHQControl.java
+++
b/modules/enterprise/server/server-control/src/main/java/org/rhq/server/control/RHQControl.java
@@ -26,6 +26,7 @@ package org.rhq.server.control;
import java.io.Console;
import java.io.File;
+import java.io.FilenameFilter;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;
@@ -74,6 +75,8 @@ public class RHQControl {
String commandName = findCommand(commands, args);
command = commands.get(commandName);
+ logWarningIfAgentRPMIsInstalled(command);
+
validateInstallCommand(command, args);
// in case the installer gets killed, prepare the shutdown hook to try
the undo
@@ -119,6 +122,47 @@ public class RHQControl {
return;
}
+ private void logWarningIfAgentRPMIsInstalled(ControlCommand command) {
+ // we only care about warning if the user is installing or upgrading; otherwise,
just return silently
+ if (!"install".equalsIgnoreCase(command.getName()) &&
(!"upgrade".equalsIgnoreCase(command.getName()))) {
+ return;
+ }
+
+ // see if we can find an RPM installation somewhere.
+ boolean rpmInstalled;
+ File rpmParentLocation = new File("/usr/share");
+ File[] rpms = rpmParentLocation.listFiles(new FilenameFilter() {
+ @Override
+ public boolean accept(File dir, String name) {
+ if (name.startsWith("jboss-on-")) {
+ File jonDir = new File(dir, name);
+ // technically, we should look for the agent in new File(jonDir,
"agent") because that's the rpm install dir.
+ // but there are no other rpms other than the agent, so if we see
this jboss-on-* location, we know the agent is here.
+ log.warn("An agent RPM installation was found in ["
+ + jonDir
+ + "]!!! You will not be able to successfully run this older
agent anymore. You should manually remove it.");
+ return true;
+ } else {
+ return false;
+ }
+ }
+ });
+
+ // if there is an RPM install on this box, we need to pause for some time to give
the user a chance to read the message
+ rpmInstalled = (rpms != null && rpms.length > 0);
+ if (rpmInstalled) {
+ try {
+ log.warn("Please read the above warnings about the existence of
agent RPM installations. This "
+ + command.getName() + " will resume in a few seconds.");
+ Thread.sleep(30000L);
+ } catch (InterruptedException ie) {
+ Thread.currentThread().interrupt();
+ }
+ }
+
+ return;
+ }
+
private void validateInstallCommand(ControlCommand command, String[] args) {
if (!"install".equalsIgnoreCase(command.getName())) {
return;
Show replies by date