FAQ
Thanks Philip! It works as you suggested. Getting to know python :)

On Tue, Apr 22, 2014 at 4:39 PM, Philip Langdale wrote:

You can invoke the underlying rest API directly, certainly. But as
set_rack_id is such a simple method, you can basically just inline it as
follows:

Given an ApiHost object called 'host':

host.rackId = '/bar'
super(ApiHost, host)._put('', ApiHost, data=host)


--phil

On 22 April 2014 15:56, Vikram Bajaj wrote:

Thanks Philip!

Is there an equivalent RestAPI that I can invoke directly? I want to
avoid creating a local copy of cm_api scripts.

Regards,
Vikram

On Tue, Apr 22, 2014 at 3:35 PM, Philip Langdale wrote:

Yes, this is a bug, unfortunately. In hosts.py, you can rename _put() to
something else, and then it will work. We'll include a fix for this in the
next update.

Thanks for reporting the problem.

--phil

On 22 April 2014 12:43, Vikram Bajaj wrote:

Hi,

I am setting the rack ID using the python v6 api and it fails with the
below error, I think it's a bug. Can someone confirm?

Note: This works with v5 API, but not with v6

host = api.get_host(<hostname>)

LOG.info('Setting host: %s to rack /default/%s' %(host.hostname, k))

host.set_rack_id('<rack id>')


Exception---

File "build/bdist.macosx-10.9-intel/egg/cm_api/endpoints/hosts.py",
line 187, in set_rack_id

File "build/bdist.macosx-10.9-intel/egg/cm_api/endpoints/hosts.py",
line 100, in _put

TypeError: _put() takes exactly 1 argument (4 given)



API

def set_rack_id(self, rackId):

"""

Update the rack ID of this host.

"""

self.rackId = rackId

self._put()

To unsubscribe from this group and stop receiving emails from it, send
an email to scm-users+unsubscribe@cloudera.org.
To unsubscribe from this group and stop receiving emails from it, send an email to scm-users+unsubscribe@cloudera.org.

Search Discussions

Discussion Posts

Previous

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 5 of 5 | next ›
Discussion Overview
groupscm-users @
categorieshadoop
postedApr 22, '14 at 7:43p
activeApr 23, '14 at 12:07a
posts5
users2
websitecloudera.com
irc#hadoop

2 users in discussion

Vikram Bajaj: 3 posts Philip Langdale: 2 posts

People

Translate

site design / logo © 2022 Grokbase