PHOENIX-4672 Align the kerberos principal config keys

Fix the configuration keys in a manner that won't break users
who are using the 'old' name.


Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo
Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/4d94f2f7
Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/4d94f2f7
Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/4d94f2f7

Branch: refs/heads/5.x-HBase-2.0
Commit: 4d94f2f7d963f59e91155b78bdf4e925feeed516
Parents: e35b18d
Author: Josh Elser <els...@apache.org>
Authored: Tue Apr 10 14:08:57 2018 -0400
Committer: Josh Elser <els...@apache.org>
Committed: Tue Apr 10 14:28:59 2018 -0400

----------------------------------------------------------------------
 .../src/main/java/org/apache/phoenix/query/QueryServices.java    | 3 ++-
 .../java/org/apache/phoenix/queryserver/server/QueryServer.java  | 4 ++++
 2 files changed, 6 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/phoenix/blob/4d94f2f7/phoenix-core/src/main/java/org/apache/phoenix/query/QueryServices.java
----------------------------------------------------------------------
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/query/QueryServices.java 
b/phoenix-core/src/main/java/org/apache/phoenix/query/QueryServices.java
index f807182..0403ff4 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/query/QueryServices.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/query/QueryServices.java
@@ -235,7 +235,8 @@ public interface QueryServices extends SQLCloseable {
     public static final String QUERY_SERVER_KEYTAB_FILENAME_ATTRIB = 
"phoenix.queryserver.keytab.file";
     public static final String QUERY_SERVER_HTTP_KEYTAB_FILENAME_ATTRIB = 
"phoenix.queryserver.http.keytab.file";
     public static final String QUERY_SERVER_KERBEROS_PRINCIPAL_ATTRIB = 
"phoenix.queryserver.kerberos.principal";
-    public static final String QUERY_SERVER_KERBEROS_HTTP_PRINCIPAL_ATTRIB = 
"phoenix.queryserver.kerberos.http.principal";
+    public static final String 
QUERY_SERVER_KERBEROS_HTTP_PRINCIPAL_ATTRIB_LEGACY = 
"phoenix.queryserver.kerberos.http.principal";
+    public static final String QUERY_SERVER_KERBEROS_HTTP_PRINCIPAL_ATTRIB = 
"phoenix.queryserver.http.kerberos.principal";
     public static final String QUERY_SERVER_DNS_NAMESERVER_ATTRIB = 
"phoenix.queryserver.dns.nameserver";
     public static final String QUERY_SERVER_DNS_INTERFACE_ATTRIB = 
"phoenix.queryserver.dns.interface";
     public static final String QUERY_SERVER_HBASE_SECURITY_CONF_ATTRIB = 
"hbase.security.authentication";

http://git-wip-us.apache.org/repos/asf/phoenix/blob/4d94f2f7/phoenix-queryserver/src/main/java/org/apache/phoenix/queryserver/server/QueryServer.java
----------------------------------------------------------------------
diff --git 
a/phoenix-queryserver/src/main/java/org/apache/phoenix/queryserver/server/QueryServer.java
 
b/phoenix-queryserver/src/main/java/org/apache/phoenix/queryserver/server/QueryServer.java
index 6b1fcfe..8436086 100644
--- 
a/phoenix-queryserver/src/main/java/org/apache/phoenix/queryserver/server/QueryServer.java
+++ 
b/phoenix-queryserver/src/main/java/org/apache/phoenix/queryserver/server/QueryServer.java
@@ -246,6 +246,10 @@ public final class QueryServer extends Configured 
implements Tool, Runnable {
         File keytab = new File(keytabPath);
         String httpKeytabPath = 
getConf().get(QueryServices.QUERY_SERVER_HTTP_KEYTAB_FILENAME_ATTRIB, null);
         String httpPrincipal = 
getConf().get(QueryServices.QUERY_SERVER_KERBEROS_HTTP_PRINCIPAL_ATTRIB, null);
+        // Backwards compat for a configuration key change
+        if (httpPrincipal == null) {
+          httpPrincipal = 
getConf().get(QueryServices.QUERY_SERVER_KERBEROS_HTTP_PRINCIPAL_ATTRIB_LEGACY, 
null);
+        }
         File httpKeytab = null;
         if (null != httpKeytabPath)
           httpKeytab = new File(httpKeytabPath);

Reply via email to