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

Review request for Ambari, Nahappan Somasundaram, Sumit Mohanty, and Sid Wagle.


Bugs: AMBARI-16145
    https://issues.apache.org/jira/browse/AMBARI-16145


Repository: ambari


Description
-------

API should be take dry_run directive and check if requested host can be deleted 
w/o deleting the host and should return error if any, like host is not in 
delete friendly state.
It should also support bulk delete format


Diffs
-----

  
ambari-server/src/main/java/org/apache/ambari/server/api/resources/HostResourceDefinition.java
 c9b0878 
  
ambari-server/src/main/java/org/apache/ambari/server/controller/internal/HostResourceProvider.java
 4dc47be 
  
ambari-server/src/test/java/org/apache/ambari/server/controller/internal/HostResourceProviderTest.java
 1c91477 

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


Testing
-------

curl -i -X DELETE -u admin:admin -H 'X-Requested-By:ambari' 
http://c6401.ambari.apache.org:8080/api/v1/clusters/a/hosts/?dry_run=true -d 
'{"RequestInfo":{"query":"Hosts/host_name.in(c6401.ambari.apache.org,c6402.ambari.apache.org)"}}'
{
  "deleteResult" : [
    {
      "deleted" : {
        "key" : "c6402.ambari.apache.org"
      }
    },
    {
      "error" : {
        "key" : "c6401.ambari.apache.org",
        "code" : 500,
        "message" : "org.apache.ambari.server.AmbariException: Cannot remove 
host c6401.ambari.apache.org from a.  The following roles exist, and these 
components must be stopped if running, and then deleted: ZOOKEEPER_SERVER"
      }
    }
  ]
}

curl -i -X DELETE -u admin:admin -H 'X-Requested-By:ambari' 
'http://c6401.ambari.apache.org:8080/api/v1/clusters/a/hosts/?dry_run=true&Hosts/host_name=c6401.ambari.apache.org'
{
  "status" : 500,
  "message" : "org.apache.ambari.server.controller.spi.SystemException: An 
internal system exception occurred: Cannot remove host c6401.ambari.apache.org 
from a.  The following roles exist, and these components must be stopped if 
running, and then deleted: ZOOKEEPER_SERVER"
}


curl -i -X DELETE -u admin:admin -H 'X-Requested-By:ambari' 
'http://c6401.ambari.apache.org:8080/api/v1/clusters/a/hosts/?dry_run=true&Hosts/host_name=c6402.ambari.apache.org'

200 OK


Thanks,

Ajit Kumar

Reply via email to