You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ambari.apache.org by subin m <su...@apache.org> on 2014/05/12 08:52:37 UTC

Review Request 21313: Python Client should support HTTP Headers

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

Review request for Ambari, Mahadev Konar and subin m.


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


Repository: ambari


Description
-------

Ambari Server now expects an additional HTTP header called "X-Requested-By" for all non-GET calls. The value can be set to anything. For example:
curl -i -H 'X-Requested-By: mycompany' -X POST -d '{"Clusters": {"version": "HDP-2.0.6"}}' --user admin:admin http://hadoop1.mycompany.com:8080/api/v1/clusters/cluster1

 The Ambari client can be created as below
headers_dict=
{'X-Requested-By':'mycompany'}


client = AmbariClient("localhost", 8080, "admin", "admin", version=1,http_header=headers_dict)

OR 

***for backward compatibilty***
headers_dict={'X-Requested-By':'mycompany'}
client = AmbariClient("localhost", 8080, "admin", "admin", version=1)
client.set_headers(headers_dict)


Diffs
-----

  ambari-client/src/main/python/ambari_client/ambari_api.py 9f8e109 
  ambari-client/src/main/python/ambari_client/core/http_client.py 188af83 
  ambari-client/src/main/python/ambari_client/model/base_model.py f99c0b8 
  ambari-client/src/main/python/ambari_client/model/cluster.py f765f2b 
  ambari-client/src/main/python/ambari_client/model/configuration.py 6cd2c2a 
  ambari-client/src/main/python/ambari_client/model/paths.py 1f43548 
  ambari-client/src/main/python/ambari_client/model/service.py e9579c4 
  ambari-client/src/main/python/ambari_client/model/status.py ff31220 
  ambari-client/src/main/python/ambari_client/model/utils.py 38add26 

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


Testing
-------

test_get_cluster (TestAmbariClient.TestAmbariClient) ... ok
test_get_components (TestAmbariClient.TestAmbariClient) ... ok
test_get_config (TestAmbariClient.TestAmbariClient) ... ok
test_get_host (TestAmbariClient.TestAmbariClient) ... ok
test_init (TestAmbariClient.TestAmbariClient) ... ok

----------------------------------------------------------------------
Ran 47 tests in 0.131s

OK

[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.874s
[INFO] Finished at: Mon May 12 12:19:50 IST 2014
[INFO] Final Memory: 12M/420M
[INFO] -----------------------------------------------------------------------


Thanks,

subin m


Re: Review Request 21313: Python Client should support HTTP Headers

Posted by Mahadev Konar <ma...@apache.org>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/21313/#review43115
-----------------------------------------------------------

Ship it!


Ship It!

- Mahadev Konar


On May 12, 2014, 6:52 a.m., subin m wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/21313/
> -----------------------------------------------------------
> 
> (Updated May 12, 2014, 6:52 a.m.)
> 
> 
> Review request for Ambari, Mahadev Konar and subin m.
> 
> 
> Bugs: https://issues.apache.org/jira/browse/AMBARI-5663
>     https://issues.apache.org/jira/browse/https://issues.apache.org/jira/browse/AMBARI-5663
> 
> 
> Repository: ambari
> 
> 
> Description
> -------
> 
> Ambari Server now expects an additional HTTP header called "X-Requested-By" for all non-GET calls. The value can be set to anything. For example:
> curl -i -H 'X-Requested-By: mycompany' -X POST -d '{"Clusters": {"version": "HDP-2.0.6"}}' --user admin:admin http://hadoop1.mycompany.com:8080/api/v1/clusters/cluster1
> 
>  The Ambari client can be created as below
> headers_dict=
> {'X-Requested-By':'mycompany'}
> 
> 
> client = AmbariClient("localhost", 8080, "admin", "admin", version=1,http_header=headers_dict)
> 
> OR 
> 
> ***for backward compatibilty***
> headers_dict={'X-Requested-By':'mycompany'}
> client = AmbariClient("localhost", 8080, "admin", "admin", version=1)
> client.set_headers(headers_dict)
> 
> 
> Diffs
> -----
> 
>   ambari-client/src/main/python/ambari_client/ambari_api.py 9f8e109 
>   ambari-client/src/main/python/ambari_client/core/http_client.py 188af83 
>   ambari-client/src/main/python/ambari_client/model/base_model.py f99c0b8 
>   ambari-client/src/main/python/ambari_client/model/cluster.py f765f2b 
>   ambari-client/src/main/python/ambari_client/model/configuration.py 6cd2c2a 
>   ambari-client/src/main/python/ambari_client/model/paths.py 1f43548 
>   ambari-client/src/main/python/ambari_client/model/service.py e9579c4 
>   ambari-client/src/main/python/ambari_client/model/status.py ff31220 
>   ambari-client/src/main/python/ambari_client/model/utils.py 38add26 
> 
> Diff: https://reviews.apache.org/r/21313/diff/
> 
> 
> Testing
> -------
> 
> test_get_cluster (TestAmbariClient.TestAmbariClient) ... ok
> test_get_components (TestAmbariClient.TestAmbariClient) ... ok
> test_get_config (TestAmbariClient.TestAmbariClient) ... ok
> test_get_host (TestAmbariClient.TestAmbariClient) ... ok
> test_init (TestAmbariClient.TestAmbariClient) ... ok
> 
> ----------------------------------------------------------------------
> Ran 47 tests in 0.131s
> 
> OK
> 
> [INFO] ------------------------------------------------------------------------
> [INFO] BUILD SUCCESS
> [INFO] ------------------------------------------------------------------------
> [INFO] Total time: 2.874s
> [INFO] Finished at: Mon May 12 12:19:50 IST 2014
> [INFO] Final Memory: 12M/420M
> [INFO] -----------------------------------------------------------------------
> 
> 
> Thanks,
> 
> subin m
> 
>