modules/enterprise/server/server-control/src/main/java/org/rhq/server/control/command/AbstractInstall.java
| 13 ++++++----
modules/enterprise/server/server-control/src/main/java/org/rhq/server/control/command/Install.java
| 12 ++++-----
2 files changed, 14 insertions(+), 11 deletions(-)
New commits:
commit 1fd86a037994bf8c151ec10d63afec0435875d37
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Thu Aug 29 11:28:52 2013 -0400
Bug 1001668
rhqctl.bat install --storage removes and re installs existing/installed storage
service - windows
On Windows, When executing rhqctl install, don't re-install the service unless it
is missing.
diff --git
a/modules/enterprise/server/server-control/src/main/java/org/rhq/server/control/command/AbstractInstall.java
b/modules/enterprise/server/server-control/src/main/java/org/rhq/server/control/command/AbstractInstall.java
index fb9bceb..a14553b 100644
---
a/modules/enterprise/server/server-control/src/main/java/org/rhq/server/control/command/AbstractInstall.java
+++
b/modules/enterprise/server/server-control/src/main/java/org/rhq/server/control/command/AbstractInstall.java
@@ -59,17 +59,20 @@ public abstract class AbstractInstall extends ControlCommand {
protected final String STORAGE_CONFIG_PROP =
"rhqctl.install.storage-config";
- protected void installWindowsService(File workingDir, String batFile, boolean start)
throws Exception {
+ protected void installWindowsService(File workingDir, String batFile, boolean
replaceExistingService, boolean start)
+ throws Exception {
Executor executor = new DefaultExecutor();
executor.setWorkingDirectory(workingDir);
executor.setStreamHandler(new PumpStreamHandler());
org.apache.commons.exec.CommandLine commandLine;
- commandLine = getCommandLine(batFile, "stop");
- executor.execute(commandLine);
+ if (replaceExistingService) {
+ commandLine = getCommandLine(batFile, "stop");
+ executor.execute(commandLine);
- commandLine = getCommandLine(batFile, "remove");
- executor.execute(commandLine);
+ commandLine = getCommandLine(batFile, "remove");
+ executor.execute(commandLine);
+ }
commandLine = getCommandLine(batFile, "install");
executor.execute(commandLine);
diff --git
a/modules/enterprise/server/server-control/src/main/java/org/rhq/server/control/command/Install.java
b/modules/enterprise/server/server-control/src/main/java/org/rhq/server/control/command/Install.java
index 0808db2..57e3dad 100644
---
a/modules/enterprise/server/server-control/src/main/java/org/rhq/server/control/command/Install.java
+++
b/modules/enterprise/server/server-control/src/main/java/org/rhq/server/control/command/Install.java
@@ -142,7 +142,7 @@ public class Install extends AbstractInstall {
if (!isStorageInstalled()) {
installStorageNode(getStorageBasedir(), commandLine);
} else if (isWindows()) {
- installWindowsService(getBinDir(), "rhq-storage", true);
+ installWindowsService(getBinDir(), "rhq-storage", false,
true);
}
if (!isServerInstalled()) {
@@ -150,7 +150,7 @@ public class Install extends AbstractInstall {
runRHQServerInstaller();
waitForRHQServerToInitialize();
} else if (isWindows()) {
- installWindowsService(getBinDir(), "rhq-server", true);
+ installWindowsService(getBinDir(), "rhq-server", false,
true);
}
if (!isAgentInstalled()) {
@@ -166,7 +166,7 @@ public class Install extends AbstractInstall {
}
} else if (isWindows()) {
boolean start =
Boolean.parseBoolean(commandLine.getOptionValue(AGENT_AUTOSTART_OPTION,
"true"));
- installWindowsService(new File(getAgentBasedir(), "bin"),
"rhq-agent-wrapper", start);
+ installWindowsService(new File(getAgentBasedir(), "bin"),
"rhq-agent-wrapper", false, start);
}
} else {
@@ -175,7 +175,7 @@ public class Install extends AbstractInstall {
log.info("The RHQ storage node is already installed in
" + new File(getBaseDir(), "storage"));
if (isWindows()) {
- installWindowsService(getBinDir(), "rhq-storage",
true);
+ installWindowsService(getBinDir(), "rhq-storage",
false, true);
} else {
log.info("Skipping storage node installation.");
}
@@ -202,7 +202,7 @@ public class Install extends AbstractInstall {
log.warn("The RHQ server is already installed.");
if (isWindows()) {
- installWindowsService(getBinDir(), "rhq-server",
true);
+ installWindowsService(getBinDir(), "rhq-server",
false, true);
} else {
log.info("Skipping server installation.");
}
@@ -222,7 +222,7 @@ public class Install extends AbstractInstall {
boolean start = Boolean
.parseBoolean(commandLine.getOptionValue(AGENT_AUTOSTART_OPTION, "true"));
if (isWindows()) {
- installWindowsService(new File(getAgentBasedir(),
"bin"), "rhq-agent-wrapper", start);
+ installWindowsService(new File(getAgentBasedir(),
"bin"), "rhq-agent-wrapper", false, start);
} else {
log.info("Skipping agent installation.");
}