Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 844599 Details for
Bug 994250
rhqctl always returns exit code 0
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
[patch]
patch to be applied on top of the earlier one
0001-BZ-994250-finish-the-merging-peer-review-for-patches.patch (text/plain), 12.29 KB, created by
John Mazzitelli
on 2014-01-02 15:52:45 UTC
(
hide
)
Description:
patch to be applied on top of the earlier one
Filename:
MIME Type:
Creator:
John Mazzitelli
Created:
2014-01-02 15:52:45 UTC
Size:
12.29 KB
patch
obsolete
>From cd527ca3005f18622c7c2fa72fa3bee1a8ad5866 Mon Sep 17 00:00:00 2001 >From: John Mazzitelli <mazz@redhat.com> >Date: Thu, 2 Jan 2014 10:50:02 -0500 >Subject: [PATCH] BZ 994250 - finish the merging/peer review for patches > submitted so that rhqctl returns proper exit codes. Note > that this completes the merge of the two submitted patches > - see git commits to master branch: > a21bd7729996d74a8154e9527b7009de1ef1181d > f56b3d88c636687296ca9d73fa030d917d1be6e8 This third commit > fixes some problems with the original patches: 1. Some > scripts/files are not found in bin/internal of the distro, > but rather are in bin/ - so we need to avoid using > getBinDir() in those cases 2. Fix the code to conform to > code conventions - DEATH TO TABS! 3. Remove a constant > that got resurrected > (ControlCommand.RHQ_STORAGE_BASEDIR_PROP is no longer > needed) 4. A couple other minor things > >--- > .../org/rhq/server/control/ControlCommand.java | 27 +++++++++---------- > .../java/org/rhq/server/control/RHQControl.java | 2 +- > .../server/control/command/AbstractInstall.java | 22 ++++++++-------- > .../java/org/rhq/server/control/command/Start.java | 4 +- > .../java/org/rhq/server/control/command/Stop.java | 2 +- > .../org/rhq/server/control/command/Upgrade.java | 8 +++--- > 6 files changed, 32 insertions(+), 33 deletions(-) > >diff --git a/modules/enterprise/server/server-control/src/main/java/org/rhq/server/control/ControlCommand.java b/modules/enterprise/server/server-control/src/main/java/org/rhq/server/control/ControlCommand.java >index 27f8e8f..a13a598 100644 >--- a/modules/enterprise/server/server-control/src/main/java/org/rhq/server/control/ControlCommand.java >+++ b/modules/enterprise/server/server-control/src/main/java/org/rhq/server/control/ControlCommand.java >@@ -60,7 +60,6 @@ public abstract class ControlCommand { > public static final String SERVER_OPTION = "server"; > public static final String STORAGE_OPTION = "storage"; > public static final String AGENT_OPTION = "agent"; >- public static final String RHQ_STORAGE_BASEDIR_PROP = "rhq.storage.basedir"; > public static final String RHQ_AGENT_BASEDIR_PROP = "rhq.agent.basedir"; > > protected static final String STORAGE_BASEDIR_NAME = "rhq-storage"; >@@ -300,7 +299,7 @@ public abstract class ControlCommand { > } > > protected String getStoragePid() throws IOException { >- File pidFile = getStoragePidFile(); >+ File pidFile = getStoragePidFile(); > > if (pidFile.exists()) { > return StreamUtil.slurp(new FileReader(pidFile)); >@@ -494,18 +493,18 @@ public abstract class ControlCommand { > > protected boolean isStorageRunning() throws IOException { > String pid = getStoragePid(); >- if(pid == null) { >- return false; >- } else if(pid != null && !isUnixPidRunning(pid)) { >- // There is a phantom pidfile >- File pidFile = getStoragePidFile(); >- if(!pidFile.delete()) { >- throw new RHQControlException("Could not delete storage pidfile " + pidFile.getAbsolutePath()); >- } >- return false; >- } else { >- return true; >- } >+ if (pid == null) { >+ return false; >+ } else if (pid != null && !isUnixPidRunning(pid)) { >+ // There is a phantom pidfile >+ File pidFile = getStoragePidFile(); >+ if (!pidFile.delete()) { >+ throw new RHQControlException("Could not delete storage pidfile " + pidFile.getAbsolutePath()); >+ } >+ return false; >+ } else { >+ return true; >+ } > } > > private class NullOutputStream extends OutputStream { >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 28a37de..88b085f 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 >@@ -135,7 +135,7 @@ public class RHQControl { > } catch (Throwable t) { > log.warn("Failed to clean up after the failed installation attempt. " > + "You may have to clean up some things before attempting to install again", t); >- rValue = EXIT_CODE_OPERATION_FAILED; >+ rValue = EXIT_CODE_OPERATION_FAILED; > } > } > >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 1b3d47b..de10b55 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 >@@ -88,14 +88,14 @@ public abstract class AbstractInstall extends ControlCommand { > executor.setStreamHandler(new PumpStreamHandler()); > org.apache.commons.exec.CommandLine commandLine; > >- int rValue = RHQControl.EXIT_CODE_OK; >+ int rValue = RHQControl.EXIT_CODE_OK; > > if (replaceExistingService) { >- commandLine = getCommandLine(batFile, "stop"); >- rValue = Math.max(rValue, executor.execute(commandLine)); >+ commandLine = getCommandLine(batFile, "stop"); >+ rValue = Math.max(rValue, executor.execute(commandLine)); > >- commandLine = getCommandLine(batFile, "remove"); >- rValue = Math.max(rValue, executor.execute(commandLine)); >+ commandLine = getCommandLine(batFile, "remove"); >+ rValue = Math.max(rValue, executor.execute(commandLine)); > } > > commandLine = getCommandLine(batFile, "install"); >@@ -277,7 +277,7 @@ public abstract class AbstractInstall extends ControlCommand { > return RHQControl.EXIT_CODE_OK; > } > >- int rValue = 0; >+ int rValue = 0; > > try { > File agentBinDir = new File(agentBasedir, "bin"); >@@ -317,7 +317,7 @@ public abstract class AbstractInstall extends ControlCommand { > throw e; > } > >- return rValue; >+ return rValue; > } > > protected int startAgent(final File agentBasedir) throws Exception { >@@ -366,7 +366,7 @@ public abstract class AbstractInstall extends ControlCommand { > Executor executor = new DefaultExecutor(); > executor.setWorkingDirectory(agentBinDir); > executor.setStreamHandler(new PumpStreamHandler()); >- org.apache.commons.exec.CommandLine commandLine = getCommandLine("rhq-agent-wrapper", "stop"); >+ org.apache.commons.exec.CommandLine commandLine; > > int rValue = 0; > >@@ -489,7 +489,7 @@ public abstract class AbstractInstall extends ControlCommand { > > log.info("The RHQ Server is ready to be upgraded by the server installer."); > >- } catch (IOException e) { >+ } catch (Exception e) { > log.error("An error occurred while starting the RHQ server: " + e.getMessage()); > throw e; > } >@@ -635,7 +635,7 @@ public abstract class AbstractInstall extends ControlCommand { > clearAgentPreferences(); > int rValue = installAgent(agentBasedir); > configureAgent(agentBasedir, commandLine); >- return rValue; >+ return rValue; > } > > private int installAgent(final File agentBasedir) throws IOException { >@@ -667,7 +667,7 @@ public abstract class AbstractInstall extends ControlCommand { > > int exitValue = executor.execute(commandLine); > log.info("The agent installer finished running with exit value " + exitValue); >- return exitValue; >+ return exitValue; > } catch (IOException e) { > log.error("An error occurred while running the agent installer: " + e.getMessage()); > throw e; >diff --git a/modules/enterprise/server/server-control/src/main/java/org/rhq/server/control/command/Start.java b/modules/enterprise/server/server-control/src/main/java/org/rhq/server/control/command/Start.java >index 5d540a1..e2ef3a8 100644 >--- a/modules/enterprise/server/server-control/src/main/java/org/rhq/server/control/command/Start.java >+++ b/modules/enterprise/server/server-control/src/main/java/org/rhq/server/control/command/Start.java >@@ -138,7 +138,7 @@ public class Start extends ControlCommand { > executor.setStreamHandler(new PumpStreamHandler()); > org.apache.commons.exec.CommandLine commandLine; > >- int rValue; >+ int rValue; > > // Cassandra looks for JAVA_HOME or then defaults to PATH. We want it to use the Java > // defined for RHQ, so make sure JAVA_HOME is set, and set to the RHQ Java for the executor >@@ -167,7 +167,7 @@ public class Start extends ControlCommand { > // For now we are duplicating logic in the status command. This code will be > // replaced when we implement a rhq-storage.sh script. > if (isStorageRunning()) { >- String pid = getStoragePid(); >+ String pid = getStoragePid(); > System.out.println("RHQ storage node (pid " + pid + ") is running"); > rValue = RHQControl.EXIT_CODE_OK; > } else { >diff --git a/modules/enterprise/server/server-control/src/main/java/org/rhq/server/control/command/Stop.java b/modules/enterprise/server/server-control/src/main/java/org/rhq/server/control/command/Stop.java >index a3920e0..7ef66b4 100644 >--- a/modules/enterprise/server/server-control/src/main/java/org/rhq/server/control/command/Stop.java >+++ b/modules/enterprise/server/server-control/src/main/java/org/rhq/server/control/command/Stop.java >@@ -144,7 +144,7 @@ public class Stop extends AbstractInstall { > rValue = RHQControl.EXIT_CODE_OPERATION_FAILED; > } > } else { >- if(isStorageRunning()) { >+ if (isStorageRunning()) { > String pid = getStoragePid(); > > System.out.println("Stopping RHQ storage node..."); >diff --git a/modules/enterprise/server/server-control/src/main/java/org/rhq/server/control/command/Upgrade.java b/modules/enterprise/server/server-control/src/main/java/org/rhq/server/control/command/Upgrade.java >index cc3d8c2..e80edd9 100644 >--- a/modules/enterprise/server/server-control/src/main/java/org/rhq/server/control/command/Upgrade.java >+++ b/modules/enterprise/server/server-control/src/main/java/org/rhq/server/control/command/Upgrade.java >@@ -186,7 +186,7 @@ public class Upgrade extends AbstractInstall { > return exitValue; > } > >- // If any failures occur during upgrade, we know we need to reset rhq-server.properties. >+ // If any failures occur during upgrade, we know we need to reset rhq-server.properties. > final FileReverter serverPropFileReverter = new FileReverter(getServerPropertiesFile()); > addUndoTask(new ControlCommand.UndoTask("Reverting server properties file") { > public void performUndoWork() throws Exception { >@@ -229,7 +229,7 @@ public class Upgrade extends AbstractInstall { > } > } catch (Throwable t) { > log.warn("Unable to stop services: " + t.getMessage()); >- rValue = RHQControl.EXIT_CODE_OPERATION_FAILED; >+ rValue = RHQControl.EXIT_CODE_OPERATION_FAILED; > } > } > >@@ -262,7 +262,7 @@ public class Upgrade extends AbstractInstall { > } > > Executor executor = new DefaultExecutor(); >- executor.setWorkingDirectory(getBinDir()); >+ executor.setWorkingDirectory(new File(getBaseDir(), "bin")); // data migrator script is not in bin/internal > executor.setStreamHandler(new PumpStreamHandler()); > > int exitValue = executor.execute(commandLine); >@@ -546,7 +546,7 @@ public class Upgrade extends AbstractInstall { > } > > // now merge the old settings in with the default properties from the new server install >- String newServerPropsFilePath = new File(getBinDir(), "rhq-server.properties").getAbsolutePath(); >+ String newServerPropsFilePath = new File(getBaseDir(), "bin/rhq-server.properties").getAbsolutePath(); > PropertiesFileUpdate newServerPropsFile = new PropertiesFileUpdate(newServerPropsFilePath); > newServerPropsFile.update(oldServerProps); > >-- >1.7.6.4 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 994250
:
783521
|
839282
|
842792
|
844599
|
844601
|
845114
|
866289