cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bhais...@apache.org
Subject [1/2] git commit: updated refs/heads/4.3 to afe1323
Date Fri, 12 Dec 2014 15:07:15 GMT
Repository: cloudstack
Updated Branches:
  refs/heads/4.3 485c76a2f -> afe1323a5


CLOUDSTACK-8070: during 4.3.1 to 4.3.2 upgrade encrypt config that are hidden

In case there is an encryption key/password is provided the value, specifically
for router.ram.size will be encrypted otherwise it will remain plain text.

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/5519095a
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/5519095a
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/5519095a

Branch: refs/heads/4.3
Commit: 5519095a2970103ac3acbd948ae1908aa2612c41
Parents: 485c76a
Author: Rohit Yadav <rohit.yadav@shapeblue.com>
Authored: Fri Dec 12 20:33:16 2014 +0530
Committer: Rohit Yadav <rohit.yadav@shapeblue.com>
Committed: Fri Dec 12 20:33:16 2014 +0530

----------------------------------------------------------------------
 engine/schema/src/com/cloud/upgrade/dao/Upgrade431to432.java | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5519095a/engine/schema/src/com/cloud/upgrade/dao/Upgrade431to432.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/upgrade/dao/Upgrade431to432.java b/engine/schema/src/com/cloud/upgrade/dao/Upgrade431to432.java
index cfad21d..30ade39 100644
--- a/engine/schema/src/com/cloud/upgrade/dao/Upgrade431to432.java
+++ b/engine/schema/src/com/cloud/upgrade/dao/Upgrade431to432.java
@@ -18,6 +18,7 @@
 package com.cloud.upgrade.dao;
 
 import java.io.File;
+import java.io.UnsupportedEncodingException;
 import java.sql.Connection;
 import java.sql.PreparedStatement;
 import java.sql.ResultSet;
@@ -28,6 +29,7 @@ import java.util.HashSet;
 import java.util.Map;
 import java.util.Set;
 
+import com.cloud.utils.crypt.DBEncryptionUtil;
 import com.cloud.utils.exception.CloudRuntimeException;
 
 import org.apache.log4j.Logger;
@@ -65,10 +67,14 @@ public class Upgrade431to432 implements DbUpgrade {
     private void updateMaxRouterSizeConfig(Connection conn) {
         PreparedStatement updatePstmt = null;
         try {
-            updatePstmt = conn.prepareStatement("UPDATE `cloud`.`configuration` SET value='256'
WHERE name='router.ram.size'");
+            String encryptedValue = DBEncryptionUtil.encrypt("256");
+            updatePstmt = conn.prepareStatement("UPDATE `cloud`.`configuration` SET value=?
WHERE name='router.ram.size' AND category = 'Hidden'");
+            updatePstmt.setBytes(1, encryptedValue.getBytes("UTF-8"));
             updatePstmt.executeUpdate();
         } catch (SQLException e) {
             throw new CloudRuntimeException("Unable to upgrade max ram size of router in
config.", e);
+        } catch (UnsupportedEncodingException e) {
+            throw new CloudRuntimeException("Unable encrypt configuration values ", e);
         } finally {
             try {
                 if (updatePstmt != null) {


Mime
View raw message