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 E291A17BB5 for ; Tue, 12 May 2015 15:07:23 +0000 (UTC) Received: (qmail 48247 invoked by uid 500); 12 May 2015 15:07:23 -0000 Delivered-To: apmail-ambari-dev-archive@ambari.apache.org Received: (qmail 48212 invoked by uid 500); 12 May 2015 15:07:23 -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 48196 invoked by uid 99); 12 May 2015 15:07:23 -0000 Received: from reviews-vm.apache.org (HELO reviews.apache.org) (140.211.11.40) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 12 May 2015 15:07:23 +0000 Received: from reviews.apache.org (localhost [127.0.0.1]) by reviews.apache.org (Postfix) with ESMTP id E4A561CC42E; Tue, 12 May 2015 15:07:23 +0000 (UTC) Content-Type: multipart/alternative; boundary="===============0634948285555771187==" MIME-Version: 1.0 Subject: Re: Review Request 33848: Blueprints processor needs stronger validation of Blueprint JSON structure From: "John Speidel" To: "John Speidel" , "Robert Levas" , "Costel Radulescu" , "Robert Nettleton" Cc: "Emil Anca" , "Ambari" Date: Tue, 12 May 2015 15:07:23 -0000 Message-ID: <20150512150723.18931.99028@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/33848/ X-Sender: "John Speidel" References: <20150512150320.12559.40121@reviews.apache.org> In-Reply-To: <20150512150320.12559.40121@reviews.apache.org> Reply-To: "John Speidel" X-ReviewRequest-Repository: ambari --===============0634948285555771187== MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit > On May 12, 2015, 3:03 p.m., Robert Nettleton wrote: > > The change looks fine to me, although I think it would be better to have more unit tests for this change. > > > > Could the submitter please detail the testing done for this patch, other than "mvn clean test"? Once some functional testing is done on this (if it hasn't been already), we can consider moving towards a merge. > > > > Thanks. +1 on confirmation of functional testing. - John ----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: https://reviews.apache.org/r/33848/#review83402 ----------------------------------------------------------- On May 5, 2015, 3:27 p.m., Emil Anca wrote: > > ----------------------------------------------------------- > This is an automatically generated e-mail. To reply, visit: > https://reviews.apache.org/r/33848/ > ----------------------------------------------------------- > > (Updated May 5, 2015, 3:27 p.m.) > > > Review request for Ambari, Costel Radulescu, John Speidel, Robert Levas, and Robert Nettleton. > > > Bugs: AMBARI-10931 > https://issues.apache.org/jira/browse/AMBARI-10931 > > > Repository: ambari > > > Description > ------- > > The Blueprints processor needs to have stronger validation during the process of handling a POST for a newly-submitted Blueprint from a REST client. > The Blueprints structure requires that the "configurations" element be an array of Maps, with each Map representing a given configuration type ("core-site", "storm-site", etc). > Typically, the configurations structure should look like: > ""configurations": [ > { > "mapred-env": { > "properties": > { "mapreduce_log_dir_prefix": "/grid/0/log/hadoop-mapreduce" } > } > }, > { "mapred-site": { > "properties": > { "install-test-mapred-site": "install-test-mapred-site-VALUE" } > } > }, > { "yarn-env": { > "properties": > { "yarn_log_dir_prefix": "/grid/0/log/hadoop" } > } > } > ]" > The snippet above is just an example to illustrate the expected format. > Recent changes to the Blueprint's structure to handle "properties_attributes" (such as "final") have modified the structure of a Blueprint, so that configuration properties are now contained in a "properties" map, internal to each configuration type. Creating new Blueprints using this newer format (the older format is still acceptable to the processor) require that the configuration types are still enclosed in a map, even though an internal map is also present, which may be a source of confusion. > An example of an incorrect format would be: > ""configurations": [ > { > "mapred-env": { > "properties": > { "mapreduce_log_dir_prefix": "/grid/0/log/hadoop-mapreduce" } > }, > "mapred-site": { > "properties": > { "install-test-mapred-site": "install-test-mapred-site-VALUE" } > }, > "yarn-env": { > "properties": > { "yarn_log_dir_prefix": "/grid/0/log/hadoop" } > } > ] > " > Please note that in the example above a single map is created, with all configuration elements being added to that entry's configuration type. This causes a corrupted Blueprint to be stored and used for deployments, since all configuration elements added in the original Blueprint will be registered under one of the config types used in the original Blueprint. This will cause many types of cluster startup failures, as the configuration elements will be added to incorrect locations. > When the Blueprint processor receives a POST submission with a new Blueprint that includes this incorrect format for "configurations", the processor must reject this submission, and send back a relevant error code/message, so that the user can resolve this problem prior to attempting a cluster deployment. > This issue will not affect the older format for Blueprints, and so any backwards-compatible Blueprints used should work fine. This issue will only occur when new Blueprints are submitted that use the newer syntax/format for defining configuration properties (with support for properties_attributes) as well. > This JIRA is being created to track this issue, as it could potentially be a user experience issue going forward, and should probably be resolved in Ambari 2.1, if possible. > > > Problem: Blueprint "configurations" element structure is not validated which leads to cluster creations error > Solution: The "configuration" element is checked for the correct structure as a List of Maps containing a single configuration type > > > Diffs > ----- > > ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BlueprintResourceProvider.java aab5395 > ambari-server/src/test/java/org/apache/ambari/server/controller/internal/BlueprintResourceProviderTest.java 118a7be > > Diff: https://reviews.apache.org/r/33848/diff/ > > > Testing > ------- > > mvn clean test > > > Thanks, > > Emil Anca > > --===============0634948285555771187==--