cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] rafaelweingartner commented on a change in pull request #2699: remove old config artifacts from update path
Date Fri, 08 Jun 2018 21:26:53 GMT
rafaelweingartner commented on a change in pull request #2699: remove old config artifacts
from update path
URL: https://github.com/apache/cloudstack/pull/2699#discussion_r194185164
 
 

 ##########
 File path: engine/schema/src/com/cloud/upgrade/dao/Upgrade41100to41110.java
 ##########
 @@ -66,6 +66,68 @@ public boolean supportsRollingUpgrade() {
     @Override
     public void performDataMigration(Connection conn) {
         updateSystemVmTemplates(conn);
+        markUnnecessarySecureConfigsAsUnsecure(conn);
+    }
+
+    private void markUnnecessarySecureConfigsAsUnsecure(Connection conn) {
+        String[] unsecureItems = new String[] {
+                "ldap.basedn",
+                "ldap.bind.principal",
+                "ldap.email.attribute",
+                "ldap.firstname.attribute",
+                "ldap.group.object",
+                "ldap.group.user.uniquemember",
+                "ldap.lastname.attribute",
+                "ldap.search.group.principle",
+                "ldap.truststore",
+                "ldap.user.object",
+                "ldap.username.attribute"
+        };
+
+        for (String name : unsecureItems) {
+            uncrypt(conn, name);
+        }
+    }
+
+    /**
+     * if encrypted, decrypt the ldap hostname and port and then update as they are not encrypted
now.
+     */
+    private void uncrypt(Connection conn, String name)
+    {
+        String value = null;
+        try (
+                PreparedStatement prepSelStmt = conn.prepareStatement("SELECT conf.category,conf.value
FROM `cloud`.`configuration` conf WHERE conf.name= ?");
+        ) {
+            prepSelStmt.setString(1,name);
+            try (
+                    ResultSet resultSet = prepSelStmt.executeQuery();
+            ) {
+                if (LOG.isInfoEnabled()) {
 
 Review comment:
   Can you remove this `isInfoEnabled` or `isDebugEnabled`? You can simply call the `LOG.info`,
and so on.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

Mime
View raw message