log.warn("The storage installer will exit due to previous errors");
return e.getErrorCode();
}
log.info("Updating rhq-server.properties...");
PropertiesFileUpdate serverPropertiesUpdater = getServerProperties();
Properties properties = new Properties();
properties.setProperty("rhq.storage.nodes", installerInfo.hostname);
properties.setProperty(StorageProperty.CQL_PORT.property(), Integer.toString(installerInfo.cqlPort));
properties.setProperty(StorageProperty.GOSSIP_PORT.property(), Integer.toString(installerInfo.gossipPort));
// carry forward the required db props from the legacy install. We need these to contact the
// DB to do a version stamp.
if (isUpgrade) {
File oldServerPropsFile = new File(fromDir, "bin/rhq-server.properties");
// if the old props file exists then carry forward the props. If we're not doing a version stamp then
// don't worry about a missing file, we're not contacting the db anyway (typically a test scenario).
if (oldServerPropsFile.exists() || !noStamp) {
Properties oldProperties = new Properties();
FileInputStream oldServerPropsFileInputStream = new FileInputStream(oldServerPropsFile);
try {
oldProperties.load(oldServerPropsFileInputStream);
properties.setProperty("rhq.server.database.connection-url",
oldProperties.getProperty("rhq.server.database.connection-url"));
properties.setProperty("rhq.server.database.user-name",
oldProperties.getProperty("rhq.server.database.user-name"));
properties.setProperty("rhq.server.database.password",
oldProperties.getProperty("rhq.server.database.password"));
} finally {
oldServerPropsFileInputStream.close();
}
}
}
// update the properties file
serverPropertiesUpdater.update(properties);
Properties dbProperties = serverPropertiesUpdater.loadExistingProperties();
// when upgrading, mark the upgrade by stamping the new version
if (isUpgrade && !noStamp) {
String version = StorageInstaller.class.getPackage().getImplementationVersion();
stampStorageNodeVersion(dbProperties, installerInfo.hostname, version);