The ApiRole <http://cloudera.github.io/cm_api/epydoc/5.0.0/index.html>class
has a *hostRef* attribute which has a hostID that you can then use to
obtain the host object, which has the IP address associated to that role.
An example below...
# Get HBase service
hbase = cdh4.get_service("hbase1")
# Get list of roles in HBase service
roles = hbase.get_all_roles()
# Combine both the role and host object together
hosts_and_roles = [{"role": role, "host":
api.get_host(role.hostRef.hostId)} for role in roles]
# Host objects have the IP address
print(host_and_roles[0]['host'].ipAddress)
u'10.20.53.15'
On Sat, May 10, 2014 at 12:47 AM, David Montgomery wrote:
Hi,
I am using the python api. I want to get the ip address for all hbase
roles by master, region server. How?
Thanks
for s in cdh4.get_all_services():
if s.type == "HBASE":
hbase = s
for r in hbase.get_all_roles():
PRINT IP ADDRESS
To unsubscribe from this group and stop receiving emails from it, send an
email to scm-users+unsubscribe@cloudera.org.
On Sat, May 10, 2014 at 12:47 AM, David Montgomery wrote:
Hi,
I am using the python api. I want to get the ip address for all hbase
roles by master, region server. How?
Thanks
for s in cdh4.get_all_services():
if s.type == "HBASE":
hbase = s
for r in hbase.get_all_roles():
PRINT IP ADDRESS
To unsubscribe from this group and stop receiving emails from it, send an
email to scm-users+unsubscribe@cloudera.org.
--
Ricky Saltzer
http://www.cloudera.com
To unsubscribe from this group and stop receiving emails from it, send an email to scm-users+unsubscribe@cloudera.org.