<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>question Cloudera API doesn't return any roles for a host in Archives of Support Questions (Read Only)</title>
    <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Cloudera-API-doesn-t-return-any-roles-for-a-host/m-p/54338#M60368</link>
    <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;I am starting working with the Cloudera API using python. My code is very simple:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;# Print all hostnames and hostIds
for host in api.get_all_hosts():
print host.hostname + " - " + host.hostId
print host.roleRefs&lt;/PRE&gt;&lt;P&gt;I get values for the hostname and the hostId but NOTHING for roles.&lt;/P&gt;&lt;P&gt;I am using AWS with AutoScaling, so my idea is, when one datanode dies, create a Lambda to add&lt;BR /&gt;this new host to the cluster and assign the proper roles, so I want to check which hosts have&lt;BR /&gt;role already assigned or not.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My output :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;All roles defined:
[u'DATANODE', u'NAMENODE', u'SECONDARYNAMENODE', u'BALANCER', u'GATEWAY', u'HTTPFS', u'FAILOVERCONTROLLER', u'JOURNALNODE', u'NFSGATEWAY']
[&amp;lt;cm_api.endpoints.types.ApiRoleRef object at 0x10d2dd0d0&amp;gt;, &amp;lt;cm_api.endpoints.types.ApiRoleRef object at 0x10d2dd6d0&amp;gt;]
-hadoopdatanode01.domain.com - f17671f2-b5a5-46c5-818e-5d560646fc52
None
-hadoopdatanode02.domain.com - cf2b59bc-63eb-4ca0-a917-fd6c6d9a4968
None
-hadoopdatanode03.domain.com - ccecb57c-d729-4177-a324-c2ec2655664f
None
-hadoopdatanode04.domain.com - ba7435a5-c406-43e8-94a0-bb112f8d7caa
None
-hadoopdatanode05.domain.com - f39cd9f8-f229-46bd-a187-b0f5e9121cc8
None&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have not idea what the problem could be. Roles have been assigned manually to these hosts using ClouderaManager&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;</description>
    <pubDate>Wed, 03 May 2017 09:40:58 GMT</pubDate>
    <dc:creator>awsbiddata</dc:creator>
    <dc:date>2017-05-03T09:40:58Z</dc:date>
    <item>
      <title>Cloudera API doesn't return any roles for a host</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Cloudera-API-doesn-t-return-any-roles-for-a-host/m-p/54338#M60368</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;I am starting working with the Cloudera API using python. My code is very simple:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;# Print all hostnames and hostIds
for host in api.get_all_hosts():
print host.hostname + " - " + host.hostId
print host.roleRefs&lt;/PRE&gt;&lt;P&gt;I get values for the hostname and the hostId but NOTHING for roles.&lt;/P&gt;&lt;P&gt;I am using AWS with AutoScaling, so my idea is, when one datanode dies, create a Lambda to add&lt;BR /&gt;this new host to the cluster and assign the proper roles, so I want to check which hosts have&lt;BR /&gt;role already assigned or not.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My output :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;All roles defined:
[u'DATANODE', u'NAMENODE', u'SECONDARYNAMENODE', u'BALANCER', u'GATEWAY', u'HTTPFS', u'FAILOVERCONTROLLER', u'JOURNALNODE', u'NFSGATEWAY']
[&amp;lt;cm_api.endpoints.types.ApiRoleRef object at 0x10d2dd0d0&amp;gt;, &amp;lt;cm_api.endpoints.types.ApiRoleRef object at 0x10d2dd6d0&amp;gt;]
-hadoopdatanode01.domain.com - f17671f2-b5a5-46c5-818e-5d560646fc52
None
-hadoopdatanode02.domain.com - cf2b59bc-63eb-4ca0-a917-fd6c6d9a4968
None
-hadoopdatanode03.domain.com - ccecb57c-d729-4177-a324-c2ec2655664f
None
-hadoopdatanode04.domain.com - ba7435a5-c406-43e8-94a0-bb112f8d7caa
None
-hadoopdatanode05.domain.com - f39cd9f8-f229-46bd-a187-b0f5e9121cc8
None&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have not idea what the problem could be. Roles have been assigned manually to these hosts using ClouderaManager&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;</description>
      <pubDate>Wed, 03 May 2017 09:40:58 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Cloudera-API-doesn-t-return-any-roles-for-a-host/m-p/54338#M60368</guid>
      <dc:creator>awsbiddata</dc:creator>
      <dc:date>2017-05-03T09:40:58Z</dc:date>
    </item>
    <item>
      <title>Re: Cloudera API doesn't return any roles for a host</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Cloudera-API-doesn-t-return-any-roles-for-a-host/m-p/54364#M60369</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;api.get_all_hosts() returns just basic information about a host by default, a SUMMARY view. You probably want the FULL view. See docs here:&lt;/P&gt;&lt;P&gt;&lt;A href="https://cloudera.github.io/cm_api/epydoc/5.11.0/cm_api.api_client.ApiResource-class.html#get_all_hosts" target="_blank"&gt;https://cloudera.github.io/cm_api/epydoc/5.11.0/cm_api.api_client.ApiResource-class.html#get_all_hosts&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you do a simple HTTP GET on {CM_HOST:PORT}/api/v{version}/hosts you can easily see the kind of stuff returned by api.get_all_hosts(), and if you look at {CM_HOST:PORT}/api/v{version}/hosts?view=FULL you'll see you can get more details, like the role refs.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For your use-case of replacing a failed node, there's significant trickiness in getting the steps just right. You may want to look into Cloudera Director, which can repair worker or gateway nodes, among many other features. Here's the doc page for repairing a node:&lt;/P&gt;&lt;P&gt;&lt;A href="https://www.cloudera.com/documentation/director/latest/topics/director_ui_cluster_shrink.html" target="_blank"&gt;https://www.cloudera.com/documentation/director/latest/topics/director_ui_cluster_shrink.html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Darren&lt;/P&gt;</description>
      <pubDate>Wed, 03 May 2017 18:03:45 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Cloudera-API-doesn-t-return-any-roles-for-a-host/m-p/54364#M60369</guid>
      <dc:creator>Darren</dc:creator>
      <dc:date>2017-05-03T18:03:45Z</dc:date>
    </item>
  </channel>
</rss>

