Return-Path: X-Original-To: apmail-ambari-dev-archive@www.apache.org Delivered-To: apmail-ambari-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 49EDC17B1B for ; Wed, 20 May 2015 14:15:25 +0000 (UTC) Received: (qmail 69539 invoked by uid 500); 20 May 2015 14:15:25 -0000 Delivered-To: apmail-ambari-dev-archive@ambari.apache.org Received: (qmail 69508 invoked by uid 500); 20 May 2015 14:15:25 -0000 Mailing-List: contact dev-help@ambari.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@ambari.apache.org Delivered-To: mailing list dev@ambari.apache.org Received: (qmail 69492 invoked by uid 99); 20 May 2015 14:15:24 -0000 Received: from reviews-vm.apache.org (HELO reviews.apache.org) (140.211.11.40) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 20 May 2015 14:15:24 +0000 Received: from reviews.apache.org (localhost [127.0.0.1]) by reviews.apache.org (Postfix) with ESMTP id A82E11DBE70; Wed, 20 May 2015 14:15:24 +0000 (UTC) Content-Type: multipart/alternative; boundary="===============8068601006368376896==" MIME-Version: 1.0 Subject: Re: Review Request 34409: templeton.hive.properties property value substitution should be done by ambari-server From: "John Speidel" To: "Emil Anca" , "John Speidel" , "Robert Nettleton" Cc: "Robert Levas" , "Ambari" Date: Wed, 20 May 2015 14:15:24 -0000 Message-ID: <20150520141524.1466.62063@reviews.apache.org> X-ReviewBoard-URL: https://reviews.apache.org/ Auto-Submitted: auto-generated Sender: "John Speidel" X-ReviewGroup: Ambari X-ReviewRequest-URL: https://reviews.apache.org/r/34409/ X-Sender: "John Speidel" References: <20150519190641.14202.12485@reviews.apache.org> In-Reply-To: <20150519190641.14202.12485@reviews.apache.org> Reply-To: "John Speidel" X-ReviewRequest-Repository: ambari --===============8068601006368376896== MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit ----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: https://reviews.apache.org/r/34409/#review84513 ----------------------------------------------------------- Ship it! Ship It! - John Speidel On May 19, 2015, 7:06 p.m., Robert Levas wrote: > > ----------------------------------------------------------- > This is an automatically generated e-mail. To reply, visit: > https://reviews.apache.org/r/34409/ > ----------------------------------------------------------- > > (Updated May 19, 2015, 7:06 p.m.) > > > Review request for Ambari, Emil Anca, John Speidel, and Robert Nettleton. > > > Bugs: AMBARI-11202 > https://issues.apache.org/jira/browse/AMBARI-11202 > > > Repository: ambari > > > Description > ------- > > The webhcat-site/templeton.hive.properties property value substitution should be done by ambari-server. This value is more complicated than others since the (embedded) hive.metastore.uris property is a list of thrift URIs generated using the set of hosts the Hive Metastore is installed on. This list of hosts comes from the clusterHostInfo/hive_metastore_host value, which in the KerberosHelper (org.apache.ambari.server.controller.KerberosHelper) is available as a comma-delimited list of hosts. > > ``` > clusterHostInfo/hive_metastore_host = "host1,host2,host3" > ``` > > To generate configuration values when enabling Kerberos, the KerberosHelper class uses org.apache.ambari.server.state.kerberos.AbstractKerberosDescriptor#replaceVariables to replace variables specified in the Kerberos Descriptor. Currently this mechanism uses a simple replacement scheme, which is not sufficient to generate string using a delimited list of values. > > In order to solve this issue, "functions" need to be applied to replacement data before making the substitution. In this case a "function" named "each" will be created that takes the following arguments: > * pattern with placeholders > * delimiter to use to concatenate values generated using the patter > * regex to use to split the original string > > For example (*commas are escaped when not intended to separate function args*): > > ``` > each(thrift://%s:9083, \,, \s*\,\s*) > ``` > > > To indicate this function is to be used, the following Kerberos Descriptor variable replacement syntax is to be used: > ``` > ${clusterHostInfo/hive_metastore_host|each(thrift://%s:9083, \,, \s*\,\s*)} > ``` > Note: \ characters need to be escaped in JSON structure values. For example: > ``` > "some.property" : "${clusterHostInfo/hive_metastore_host|each(thrift://%s:9083, \\,, \s*\,\s*)}" > ``` > > If clusterHostInfo/hive_metastore_host = "host1,host2,host3", the result would be > ``` > thrift://host1:9083\,thrift://host2:9083\,thrift://host3:9083 > ``` > > As part of the solution, org.apache.ambari.server.state.kerberos.AbstractKerberosDescriptor#replaceVariables was moved to org.apache.ambari.server.state.kerberos.VariableReplacementHelper#replaceVariables. > > > Diffs > ----- > > ambari-server/src/main/java/org/apache/ambari/server/controller/KerberosHelper.java e083b0e > ambari-server/src/main/java/org/apache/ambari/server/state/kerberos/AbstractKerberosDescriptor.java b49fec1 > ambari-server/src/main/java/org/apache/ambari/server/state/kerberos/KerberosKeytabDescriptor.java 404efa2 > ambari-server/src/main/java/org/apache/ambari/server/state/kerberos/KerberosPrincipalDescriptor.java 6e5ac5c > ambari-server/src/main/java/org/apache/ambari/server/state/kerberos/VariableReplacementHelper.java PRE-CREATION > ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/kerberos.json 932b71b > ambari-server/src/test/java/org/apache/ambari/server/state/kerberos/KerberosDescriptorTest.java 637facc > ambari-server/src/test/java/org/apache/ambari/server/state/kerberos/VariableReplacementHelperTest.java PRE-CREATION > ambari-web/app/controllers/main/admin/kerberos/step4_controller.js a48baaf > > Diff: https://reviews.apache.org/r/34409/diff/ > > > Testing > ------- > > Manually tested with 1 and 2 HiveMeta stores avaialble before enabled Kerberos, then adding an additional Hive MetaStore to see that the *each* function generated the correct value. > > Added new unit tests > > Running org.apache.ambari.server.state.kerberos.VariableReplacementHelperTest > Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.14 sec > > # Jenkins test results: > > Running org.apache.ambari.server.state.kerberos.VariableReplacementHelperTest > Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.168 sec > > Tests run: 2996, Failures: 0, Errors: 0, Skipped: 21 > > [INFO] ------------------------------------------------------------------------ > [INFO] BUILD SUCCESS > [INFO] ------------------------------------------------------------------------ > [INFO] Total time: 01:36 h > [INFO] Finished at: 2015-05-19T17:28:39+00:00 > [INFO] Final Memory: 47M/516M > [INFO] ------------------------------------------------------------------------ > > > Thanks, > > Robert Levas > > --===============8068601006368376896==--