From: <dcr...@hy...> - 2010-04-12 19:03:02
|
Author: dcrutchf Date: 2010-04-12 12:02:54 -0700 (Mon, 12 Apr 2010) New Revision: 14496 URL: http://svn.hyperic.org/?view=rev&root=Hyperic+HQ&revision=14496 Modified: trunk/plugins/mysql_stats/src/org/hyperic/hq/plugin/mysql_stats/MySqlServerDetector.java Log: Enhanced logic to test for MySQL version via --help (the existing mechanism), then check --version if version number wasn't found. Modified: trunk/plugins/mysql_stats/src/org/hyperic/hq/plugin/mysql_stats/MySqlServerDetector.java =================================================================== --- trunk/plugins/mysql_stats/src/org/hyperic/hq/plugin/mysql_stats/MySqlServerDetector.java 2010-04-12 07:56:00 UTC (rev 14495) +++ trunk/plugins/mysql_stats/src/org/hyperic/hq/plugin/mysql_stats/MySqlServerDetector.java 2010-04-12 19:02:54 UTC (rev 14496) @@ -302,7 +302,12 @@ { List servers = new ArrayList(); String installdir = getParentDir(path, 2); - String version = getVersion(path); + String version = getVersion(path, "--help"); + + if (version == null) { + version = getVersion(path, "--version"); + } + // ensure this instance of ServerDetector is associated with the // correct version if (!getTypeInfo().getVersion().equals(version)) { @@ -338,12 +343,11 @@ return rtn.toString(); } - private String getVersion(String executable) { + private String getVersion(String executable, String arg) { try { ByteArrayOutputStream output = new ByteArrayOutputStream(); Execute exec = new Execute(new PumpStreamHandler(output)); - exec.setCommandline( - new String[] {executable, "--help"}); + exec.setCommandline(new String[] {executable, arg}); int res = exec.execute(); if (res != 0) { return null; |