mirror of https://github.com/apache/cloudstack.git
bug CS-15168: Use cagetory from DB instead of Config.java, set category to Hidden during upgrade if they are not already
status CS-15168: resolved fixed reviewed-by: Nitin
This commit is contained in:
parent
f6fb322c7b
commit
fc44c5203e
|
|
@ -283,14 +283,15 @@ public class ConfigurationManagerImpl implements ConfigurationManager, Configura
|
|||
|
||||
// As it is so common for people to forget about configuring
|
||||
// management.network.cidr,
|
||||
String mgtCidr = _configDao.getValue(Config.ManagementNetwork.key());
|
||||
ConfigurationVO mgmtNetwork = _configDao.findByName(Config.ManagementNetwork.key());
|
||||
String mgtCidr = mgmtNetwork.getValue();
|
||||
if (mgtCidr == null || mgtCidr.trim().isEmpty()) {
|
||||
String[] localCidrs = NetUtils.getLocalCidrs();
|
||||
if (localCidrs.length > 0) {
|
||||
s_logger.warn("Management network CIDR is not configured originally. Set it default to " + localCidrs[0]);
|
||||
|
||||
_alertMgr.sendAlert(AlertManager.ALERT_TYPE_MANAGMENT_NODE, 0, new Long(0), "Management network CIDR is not configured originally. Set it default to " + localCidrs[0], "");
|
||||
_configDao.update(Config.ManagementNetwork.key(), Config.ManagementNetwork.getCategory(), localCidrs[0]);
|
||||
_configDao.update(Config.ManagementNetwork.key(), mgmtNetwork.getCategory(), localCidrs[0]);
|
||||
} else {
|
||||
s_logger.warn("Management network CIDR is not properly configured and we are not able to find a default setting");
|
||||
_alertMgr.sendAlert(AlertManager.ALERT_TYPE_MANAGMENT_NODE, 0, new Long(0), "Management network CIDR is not properly configured and we are not able to find a default setting", "");
|
||||
|
|
|
|||
|
|
@ -163,14 +163,15 @@ public class ConfigurationDaoImpl extends GenericDaoBase<ConfigurationVO, String
|
|||
String returnValue = initValue;
|
||||
try {
|
||||
txn.start();
|
||||
stmt = txn.prepareAutoCloseStatement("SELECT value FROM configuration WHERE name=?");
|
||||
stmt = txn.prepareAutoCloseStatement("SELECT value, category FROM configuration WHERE name=?");
|
||||
stmt.setString(1, name);
|
||||
ResultSet rs = stmt.executeQuery();
|
||||
if(rs != null && rs.next()) {
|
||||
returnValue = rs.getString(1);
|
||||
String category1 = rs.getString(2);
|
||||
if(returnValue != null) {
|
||||
txn.commit();
|
||||
if("Hidden".equals(category) || "Secure".equals(category)){
|
||||
if("Hidden".equals(category1) || "Secure".equals(category1)){
|
||||
return DBEncryptionUtil.decrypt(returnValue);
|
||||
} else {
|
||||
return returnValue;
|
||||
|
|
|
|||
|
|
@ -421,10 +421,11 @@ public class ConfigurationServerImpl implements ConfigurationServer {
|
|||
|
||||
protected void updateCloudIdentifier() {
|
||||
// Creates and saves a UUID as the cloud identifier
|
||||
String currentCloudIdentifier = _configDao.getValue("cloud.identifier");
|
||||
ConfigurationVO cloudIdentifier = _configDao.findByName("cloud.identifier");
|
||||
String currentCloudIdentifier = cloudIdentifier.getValue();
|
||||
if (currentCloudIdentifier == null || currentCloudIdentifier.isEmpty()) {
|
||||
String uuid = UUID.randomUUID().toString();
|
||||
_configDao.update(Config.CloudIdentifier.key(), Config.CloudIdentifier.getCategory(), uuid);
|
||||
_configDao.update(Config.CloudIdentifier.key(), cloudIdentifier.getCategory(), uuid);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue