more cpvm refactoring

This commit is contained in:
abhishek 2010-10-26 16:29:41 -07:00
parent b08037d22c
commit 4d2e126ea1
2 changed files with 5 additions and 10 deletions

View File

@ -109,14 +109,13 @@ public class ConsoleProxyResource extends ServerResourceBase implements ServerRe
protected Answer execute(final UpdateCertificateCommand cmd) {
boolean success = false;
try{
try
{
String certificate = cmd.getCertificate();
//write the cert to /etc/cloud/consoleproxy/cert/
boolean dirCreated = false;
String strDirectoy = "/etc/cloud/consoleproxy/cert/";
dirCreated = (new File(strDirectoy)).mkdirs();
if (dirCreated)
{
if(s_logger.isDebugEnabled())
@ -128,13 +127,13 @@ public class ConsoleProxyResource extends ServerResourceBase implements ServerRe
//Close the output stream
out.close();
success = true;
}
return new Answer(cmd, success, "Custom certificate update required status");
}
}catch (Exception e)
{
s_logger.error("Unable to read the cert string in console proxy resource",e);
success = false;
}
return new Answer(cmd, success, "Custom certificate response from the updatecertificate flow");
}

View File

@ -5880,11 +5880,9 @@ public class ManagementServerImpl implements ManagementServer {
//certficate uploaded to db successfully
//get a list of all Console proxies from the cp table
List<ConsoleProxyVO> cpList = _consoleProxyDao.listAll();
for(ConsoleProxyVO cp : cpList)
{
HostVO cpHost = _hostDao.findConsoleProxyHost(cp.getName(), com.cloud.host.Host.Type.ConsoleProxy);
//now send a command to each console proxy
UpdateCertificateCommand certCmd = new UpdateCertificateCommand(_certDao.findById(certVOId).getCertificate());
try {
@ -5900,10 +5898,8 @@ public class ManagementServerImpl implements ManagementServer {
s_logger.warn("Unable to send update certificate command to the console proxy resource", e);
} catch (OperationTimedoutException e) {
s_logger.warn("Unable to send update certificate command to the console proxy resource", e);
}
}
}
return true;
}
else