Reply
New Contributor
Posts: 1
Registered: ‎09-06-2017

Needed help on CM API 'stop_roles'

Hi,

 

Can someone help me?

 

I am not able to stop roles for node specified in “xyz_host” file

 

 

host_file = open("xyz_host", "r")
host_l = host_file.readlines()
host_list =  map(str.strip, host_l)
#print host_list

cdh5 = None
for c in api.get_all_clusters():
  print c.name
  print c.version

  if c.name == "cluster":
   if c.version == "CDH5":
    cdh5 = c

for s in cdh5.get_all_services():
  print s
  for r in s.get_all_roles():
   print r
   current_host = api.get_host(r.hostRef.hostId).hostname
   if current_host in host_list:
     cmd = r.stop_roles(r.hostRef.hostId)

 

 

             

I am failing in below step.

 

 

  File "./xyz.py", line 33, in <module>
    cmd = r.stop_roles(r.hostRef.hostId)
AttributeError: 'ApiRole' object has no attribute 'stop_roles'

 

Announcements