You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ambari.apache.org by Tom Beerbower <tb...@hortonworks.com> on 2015/01/22 21:49:41 UTC

Review Request 30188: Requesting the config_groups collection resource with no registered configuration groups results in a 404 response

-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/30188/
-----------------------------------------------------------

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


Re: Review Request 30188: Requesting the config_groups collection resource with no registered configuration groups results in a 404 response

Posted by John Speidel <js...@hortonworks.com>.

> 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
> > <https://reviews.apache.org/r/30188/diff/1/?file=830290#file830290line481>
> >
> >     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
> 
>


Re: Review Request 30188: Requesting the config_groups collection resource with no registered configuration groups results in a 404 response

Posted by Tom Beerbower <tb...@hortonworks.com>.

> 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
> > <https://reviews.apache.org/r/30188/diff/1/?file=830290#file830290line481>
> >
> >     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" : [ ]
> 
> John Speidel wrote:
>     sorry, I must be missing something but why can't we just look at isCollectionResource?
>     if (! isCollectionResource()) {

oh, yeah... not thinking clearly.  That works.  No need to look at the predicate.


- Tom


-----------------------------------------------------------
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
> 
>


Re: Review Request 30188: Requesting the config_groups collection resource with no registered configuration groups results in a 404 response

Posted by Tom Beerbower <tb...@hortonworks.com>.

> 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
> > <https://reviews.apache.org/r/30188/diff/1/?file=830290#file830290line481>
> >
> >     when would we have a user predicate for non-collection resource?

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" : [ ]


- Tom


-----------------------------------------------------------
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
> 
>


Re: Review Request 30188: Requesting the config_groups collection resource with no registered configuration groups results in a 404 response

Posted by John Speidel <js...@hortonworks.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/30188/#review69261
-----------------------------------------------------------

Ship it!



ambari-server/src/main/java/org/apache/ambari/server/api/query/QueryImpl.java
<https://reviews.apache.org/r/30188/#comment113904>

    when would we have a user predicate for non-collection resource?


- John Speidel


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
> 
>


Re: Review Request 30188: Requesting the config_groups collection resource with no registered configuration groups results in a 404 response

Posted by Tom Beerbower <tb...@hortonworks.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/30188/
-----------------------------------------------------------

(Updated Jan. 23, 2015, 12:26 a.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 (updated)
-----

  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 
  ambari-server/src/test/java/org/apache/ambari/server/api/query/QueryImplTest.java fdf3ef4 
  ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ClusterControllerImplTest.java fa24c9d 

Diff: https://reviews.apache.org/r/30188/diff/


Testing (updated)
-------

Manual test APIs to verify 404 and normal operation.
Added unit tests.

All tests pass.


Thanks,

Tom Beerbower