modules/core/dbutils/src/main/scripts/dbsetup/sysconfig-data.xml
| 4 ++--
modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
| 8 ++++----
modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/InstallerServiceImpl.java
| 9 ++++++---
modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/ServerInstallUtil.java
| 8 +++++---
4 files changed, 17 insertions(+), 12 deletions(-)
New commits:
commit bff9b1589a9b8bc295ddd2230af755410a4fd016
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Thu Sep 26 12:35:08 2013 -0400
Bug 1010841 - Installation of RHQ server fails - de-obfuscating db password failed
Fix in a way that won't suffer from ambiguity or db vendor incompatibilities.
diff --git a/modules/core/dbutils/src/main/scripts/dbsetup/sysconfig-data.xml
b/modules/core/dbutils/src/main/scripts/dbsetup/sysconfig-data.xml
index ebf7189..7213fc3 100644
--- a/modules/core/dbutils/src/main/scripts/dbsetup/sysconfig-data.xml
+++ b/modules/core/dbutils/src/main/scripts/dbsetup/sysconfig-data.xml
@@ -148,9 +148,9 @@
<data ID="62" PROPERTY_KEY="STORAGE_GOSSIP_PORT"
FREAD_ONLY="TRUE"/>
- <data ID="63" PROPERTY_KEY="STORAGE_USERNAME"
PROPERTY_VALUE="" DEFAULT_PROPERTY_VALUE=""
FREAD_ONLY="TRUE"/>
+ <data ID="63" PROPERTY_KEY="STORAGE_USERNAME"
PROPERTY_VALUE="UNSET" DEFAULT_PROPERTY_VALUE="UNSET"
FREAD_ONLY="TRUE"/>
- <data ID="64" PROPERTY_KEY="STORAGE_PASSWORD"
PROPERTY_VALUE="" DEFAULT_PROPERTY_VALUE=""
FREAD_ONLY="TRUE"/>
+ <data ID="64" PROPERTY_KEY="STORAGE_PASSWORD"
PROPERTY_VALUE="UNSET" DEFAULT_PROPERTY_VALUE="UNSET"
FREAD_ONLY="TRUE"/>
</table>
diff --git a/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
b/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
index 94688f6..713aefe 100644
--- a/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
+++ b/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
@@ -2263,22 +2263,22 @@
<schema-directSQL>
<statement targetDBVendor="postgresql" desc="Adding
storage username">
INSERT INTO rhq_system_config (id, property_key, property_value,
default_property_value, fread_only)
- VALUES (63, 'STORAGE_USERNAME', null, null, true)
+ VALUES (63, 'STORAGE_USERNAME', 'UNSET',
'UNSET', true)
</statement>
<statement targetDBVendor="oracle" desc="Adding storage
username">
INSERT INTO rhq_system_config (id, property_key, property_value,
default_property_value, fread_only)
- VALUES (63, 'STORAGE_USERNAME', null, null, 1)
+ VALUES (63, 'STORAGE_USERNAME', 'UNSET',
'UNSET', 1)
</statement>
</schema-directSQL>
<schema-directSQL>
<statement targetDBVendor="postgresql" desc="Adding
storage password">
INSERT INTO rhq_system_config (id, property_key, property_value,
default_property_value, fread_only)
- VALUES (64, 'STORAGE_PASSWORD', null, null, true)
+ VALUES (64, 'STORAGE_PASSWORD', 'UNSET',
'UNSET', true)
</statement>
<statement targetDBVendor="oracle" desc="Adding default
storage password">
INSERT INTO rhq_system_config (id, property_key, property_value,
default_property_value, fread_only)
- VALUES (64, 'STORAGE_PASSWORD', null, null, 1)
+ VALUES (64, 'STORAGE_PASSWORD', 'UNSET',
'UNSET', 1)
</statement>
</schema-directSQL>
</schemaSpec>
diff --git
a/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/InstallerServiceImpl.java
b/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/InstallerServiceImpl.java
index 408442a..e10c993 100644
---
a/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/InstallerServiceImpl.java
+++
b/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/InstallerServiceImpl.java
@@ -50,7 +50,6 @@ import org.rhq.core.util.obfuscation.PicketBoxObfuscator;
import org.rhq.enterprise.server.installer.ServerInstallUtil.ExistingSchemaOption;
import org.rhq.enterprise.server.installer.ServerInstallUtil.SupportedDatabaseType;
-
/**
* @author John Mazzitelli
*/
@@ -61,6 +60,8 @@ public class InstallerServiceImpl implements InstallerService {
private static final String EAR_NAME = "rhq.ear";
private static final String SYSPROP_PROPFILE =
"rhq.server.properties-file";
+ private static final String UNSET = "UNSET";
+
private final Log log = LogFactory.getLog(InstallerServiceImpl.class);
private final InstallerConfiguration installerConfiguration;
@@ -508,16 +509,16 @@ public class InstallerServiceImpl implements InstallerService {
throw new Exception("Could not complete the database schema
installation", e);
}
- // if the storage cluster credentials are already set (typically an HA install),
override
+ // if the storage cluster credentials are already set in the DB (typically an HA
install), override
// what's currently in the server properties file, and then continue with
storage schema setup
Map<String, String> storageProperties =
ServerInstallUtil.fetchStorageClusterSettings(serverProperties,
clearTextDbPassword);
String storageUsernameSetting =
storageProperties.get(ServerProperties.PROP_STORAGE_USERNAME);
String storagePasswordSetting =
storageProperties.get(ServerProperties.PROP_STORAGE_PASSWORD);
- if (StringUtil.isNotBlank(storageUsernameSetting)) {
+ if (!(StringUtil.isBlank(storageUsernameSetting) ||
storageUsernameSetting.equals(UNSET))) {
serverProperties.put(ServerProperties.PROP_STORAGE_USERNAME,
storageUsernameSetting);
}
- if (StringUtil.isNotBlank(storagePasswordSetting)) {
+ if (!(StringUtil.isBlank(storagePasswordSetting) ||
storagePasswordSetting.equals(UNSET))) {
serverProperties.put(ServerProperties.PROP_STORAGE_PASSWORD,
storagePasswordSetting);
}
diff --git
a/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/ServerInstallUtil.java
b/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/ServerInstallUtil.java
index c01ef5c..c5b66d7 100644
---
a/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/ServerInstallUtil.java
+++
b/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/ServerInstallUtil.java
@@ -1054,9 +1054,11 @@ public class ServerInstallUtil {
connection = getDatabaseConnection(dbUrl, userName, password);
connection.setAutoCommit(false);
- updateClusterSetting = connection.prepareStatement("UPDATE
rhq_system_config "
- + "SET property_value = ?, default_property_value = ? "
- + "WHERE property_key = ? AND property_value IS NULL AND
default_property_value IS NULL");
+ updateClusterSetting = connection.prepareStatement("" //
+ + "UPDATE rhq_system_config " //
+ + " SET property_value = ?, default_property_value = ? " //
+ + " WHERE property_key = ? " //
+ + " AND ( property_value IS NULL OR property_value = '' OR
property_value = 'UNSET' ) ");
updateClusterSetting.setString(1,
serverProperties.get(ServerProperties.PROP_STORAGE_USERNAME));
updateClusterSetting.setString(2,
serverProperties.get(ServerProperties.PROP_STORAGE_USERNAME));
commit 3bffda4fd4905f8a2a8566a115d3a33772ba3645
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Thu Sep 26 11:26:34 2013 -0400
Don't consider a blank string a valid storage username or password
diff --git
a/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/InstallerServiceImpl.java
b/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/InstallerServiceImpl.java
index 59c9360..408442a 100644
---
a/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/InstallerServiceImpl.java
+++
b/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/InstallerServiceImpl.java
@@ -43,12 +43,14 @@ import org.rhq.common.jbossas.client.controller.WebJBossASClient;
import org.rhq.core.db.DatabaseTypeFactory;
import org.rhq.core.domain.cloud.StorageNode;
import org.rhq.core.util.PropertiesFileUpdate;
+import org.rhq.core.util.StringUtil;
import org.rhq.core.util.exception.ThrowableUtil;
import org.rhq.core.util.obfuscation.Obfuscator;
import org.rhq.core.util.obfuscation.PicketBoxObfuscator;
import org.rhq.enterprise.server.installer.ServerInstallUtil.ExistingSchemaOption;
import org.rhq.enterprise.server.installer.ServerInstallUtil.SupportedDatabaseType;
+
/**
* @author John Mazzitelli
*/
@@ -512,10 +514,10 @@ public class InstallerServiceImpl implements InstallerService {
clearTextDbPassword);
String storageUsernameSetting =
storageProperties.get(ServerProperties.PROP_STORAGE_USERNAME);
String storagePasswordSetting =
storageProperties.get(ServerProperties.PROP_STORAGE_PASSWORD);
- if (null != storageUsernameSetting) {
+ if (StringUtil.isNotBlank(storageUsernameSetting)) {
serverProperties.put(ServerProperties.PROP_STORAGE_USERNAME,
storageUsernameSetting);
}
- if (null != storagePasswordSetting) {
+ if (StringUtil.isNotBlank(storagePasswordSetting)) {
serverProperties.put(ServerProperties.PROP_STORAGE_PASSWORD,
storagePasswordSetting);
}