Skip to content
This repository has been archived by the owner on Jul 11, 2022. It is now read-only.

Commit

Permalink
Merge pull request #245 from josejulio/bugs/1323325
Browse files Browse the repository at this point in the history
Bug 1323325 - rhqctl status can report storage node as ?running or ?d…
  • Loading branch information
burmanm committed Apr 21, 2016
2 parents c74673e + 1054ad0 commit c45b39b
Showing 1 changed file with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
package org.rhq.server.control.command;

import java.io.File;
import java.io.PrintStream;
import java.io.UnsupportedEncodingException;

import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.Options;
Expand Down Expand Up @@ -138,12 +140,20 @@ private int checkStorageStatus(boolean isColorSupported) throws Exception {
final String ANSI_RED = "\u001B[31m";
final String ANSI_GREEN = "\u001B[32m";
final String ANSI_RESET = "\u001B[0m";

PrintStream out = null;
try {
out = new PrintStream(System.out, true, "UTF-8");
} catch (UnsupportedEncodingException exception) {
out = System.out;
}

if (isStorageRunning()) {
System.out.println(String.format("%-30s", "RHQ Storage Node") + " (pid "
out.println(String.format("%-30s", "RHQ Storage Node") + " (pid "
+ String.format("%-7s", getStoragePid()) + ") is " + (isColorSupported ? ANSI_GREEN : "")
+ "\u2714running" + (isColorSupported ? ANSI_RESET : ""));
} else {
System.out.println(String.format("%-30s", "RHQ Storage Node") + " (no pid file) is "
out.println(String.format("%-30s", "RHQ Storage Node") + " (no pid file) is "
+ (isColorSupported ? ANSI_RED : "") + "\u2718down" + (isColorSupported ? ANSI_RESET : ""));
rValue = RHQControl.EXIT_CODE_STATUS_NOT_RUNNING;
}
Expand Down

0 comments on commit c45b39b

Please sign in to comment.