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 90DA010D56 for ; Thu, 22 Jan 2015 21:39:00 +0000 (UTC) Received: (qmail 2845 invoked by uid 500); 22 Jan 2015 21:39:00 -0000 Delivered-To: apmail-ambari-dev-archive@ambari.apache.org Received: (qmail 2807 invoked by uid 500); 22 Jan 2015 21:39:00 -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 2794 invoked by uid 99); 22 Jan 2015 21:39:00 -0000 Received: from reviews-vm.apache.org (HELO reviews.apache.org) (140.211.11.40) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 22 Jan 2015 21:39:00 +0000 Received: from reviews.apache.org (localhost [127.0.0.1]) by reviews.apache.org (Postfix) with ESMTP id 662801D5CAA; Thu, 22 Jan 2015 21:38:56 +0000 (UTC) Content-Type: multipart/alternative; boundary="===============7582778300671260848==" MIME-Version: 1.0 Subject: Re: Review Request 30188: Requesting the config_groups collection resource with no registered configuration groups results in a 404 response From: "John Speidel" To: "John Speidel" Cc: "Ambari" , "Tom Beerbower" Date: Thu, 22 Jan 2015 21:38:56 -0000 Message-ID: <20150122213856.17164.44204@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/30188/ X-Sender: "John Speidel" References: <20150122211057.9401.82564@reviews.apache.org> In-Reply-To: <20150122211057.9401.82564@reviews.apache.org> Reply-To: "John Speidel" X-ReviewRequest-Repository: ambari --===============7582778300671260848== MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit > On Jan. 22, 2015, 9:10 p.m., John Speidel wrote: > > ambari-server/src/main/java/org/apache/ambari/server/api/query/QueryImpl.java, line 481 > > > > > > when would we have a user predicate for non-collection resource? > > Tom Beerbower wrote: > true, but we still need to check both conditions, I think. Consider the following ... > > Example API Conditions Result > -------------------------------------------------------------------------------------------------------------------------------------- > NA (predicate != null, collection == false) can't happen > api/v1/clusters/c1/config_groups?ConfigGroup/id=1 (predicate != null, collection == true) empty results is okay - "items" : [ ] > api/v1/clusters/c1/config_groups/1 (predicate == null, collection == false) empty results returns 404 > api/v1/clusters/c1/config_groups (predicate == null, collection == true) empty results is okay - "items" : [ ] sorry, I must be missing something but why can't we just look at isCollectionResource? if (! isCollectionResource()) { - John ----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: https://reviews.apache.org/r/30188/#review69261 ----------------------------------------------------------- On Jan. 22, 2015, 8:49 p.m., Tom Beerbower wrote: > > ----------------------------------------------------------- > This is an automatically generated e-mail. To reply, visit: > https://reviews.apache.org/r/30188/ > ----------------------------------------------------------- > > (Updated Jan. 22, 2015, 8:49 p.m.) > > > Review request for Ambari and John Speidel. > > > Bugs: AMBARI-8342 > https://issues.apache.org/jira/browse/AMBARI-8342 > > > Repository: ambari > > > Description > ------- > > GET http://AMBARI_HOST:8080/api/v1/clusters/c1/config_groups > > { > "status" : 404, > "message" : "The requested resource doesn't exist: ConfigGroup not found, ConfigGroup/cluster_name=c1" > } > > The cluster c1 exists and has no configuration groups. The above response is incorrect. As per the api specification, it should return an empty collection. > > > Diffs > ----- > > ambari-server/src/main/java/org/apache/ambari/server/api/query/QueryImpl.java 9f1be06 > ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ClusterControllerImpl.java b075d25 > > Diff: https://reviews.apache.org/r/30188/diff/ > > > Testing > ------- > > In progress ... tests to be added > > > Thanks, > > Tom Beerbower > > --===============7582778300671260848==--