From 4d2e126ea1fadbc080a865e104d1673de46cefd3 Mon Sep 17 00:00:00 2001 From: abhishek Date: Tue, 26 Oct 2010 16:29:41 -0700 Subject: [PATCH] more cpvm refactoring --- .../resource/consoleproxy/ConsoleProxyResource.java | 9 ++++----- server/src/com/cloud/server/ManagementServerImpl.java | 6 +----- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/agent/src/com/cloud/agent/resource/consoleproxy/ConsoleProxyResource.java b/agent/src/com/cloud/agent/resource/consoleproxy/ConsoleProxyResource.java index fd45d25680d..a115c32b9e9 100644 --- a/agent/src/com/cloud/agent/resource/consoleproxy/ConsoleProxyResource.java +++ b/agent/src/com/cloud/agent/resource/consoleproxy/ConsoleProxyResource.java @@ -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"); } diff --git a/server/src/com/cloud/server/ManagementServerImpl.java b/server/src/com/cloud/server/ManagementServerImpl.java index 9571f7e46ca..d350e1aa43a 100755 --- a/server/src/com/cloud/server/ManagementServerImpl.java +++ b/server/src/com/cloud/server/ManagementServerImpl.java @@ -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 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