Yes, that worked. Thanks for the fast reply! -Chris
On Fri, Jan 17, 2014 at 12:26 PM, Yusaku Sako <[email protected]>wrote: > I think this is due to an API change to prevent CSRFs (Cross-Site Forgery > Requests). > Ambari Server now expects an additional HTTP header called > "X-Requested-By" for all non-GET calls. The value can be set to anything. > I suppose this change has not reflected in the ambari-client code yet. > > Yusaku > > > On Fri, Jan 17, 2014 at 12:19 PM, Chris Mildebrandt <[email protected] > > wrote: > >> I'm having the same issue. I just posted the details I was able to >> gather. Does this work for anyone? >> >> -Chris >> >> >> On Wed, Jan 15, 2014 at 4:41 PM, Anoop Rajendra <[email protected] >> > wrote: >> >>> Hi, >>> >>> I'm using Ambari Server version 1.4.3-38 >>> >>> I downloaded the Ambari source code from git, and built the >>> ambari-client package. >>> >>> The client API functions correctly on all GET methods. However, >>> whenever I try to use PUT or POST methods the client fails. For >>> example, my code below is very simple, >>> >>> #!/usr/bin/python >>> >>> >>> import os >>> import json >>> import logging >>> import ambari_client.ambari_api >>> logging.basicConfig() >>> >>> a = ambari_client.ambari_api.AmbariClient('compute-0-0.local') >>> print >>> a.get('stacks2/HDP/versions/2.0.6/operatingSystems/redhat6/repositories/HDP-2.0.6') >>> >>> r = {'Repositories':{'base_url':' >>> http://10.1.1.1/install/distributions/rocks-dist/x86_64'}} >>> >>> >>> a.put('stacks2/HDP/versions/2.0.6/operatingSystems/redhat6/repositories/HDP-2.0.6', >>> json.dumps(r)) >>> >>> This always returns an HTTP error 400: Bad request. >>> >>> This used to work properly with version 1.4.1-25 of the Ambari Server. >>> >>> Any ideas? >>> >>> -Anoop >>> >> >> > > CONFIDENTIALITY NOTICE > NOTICE: This message is intended for the use of the individual or entity > to which it is addressed and may contain information that is confidential, > privileged and exempt from disclosure under applicable law. If the reader > of this message is not the intended recipient, you are hereby notified that > any printing, copying, dissemination, distribution, disclosure or > forwarding of this communication is strictly prohibited. If you have > received this communication in error, please contact the sender immediately > and delete it from your system. Thank You.
