0

I want to list the configuration values of CM. So I have this code that is working on differents clusters (5.9.1, 5.10.0 and 5.8.3) :

from cm_api.api_client import ApiResource

cm_host = "XX.XX.70.12"
api = ApiResource(cm_host, username="supervision-user", password="XXXXXX" )

cm_config = api.get_cloudera_manager().get_config(view='full')

for item in cm_config:
  print("%s   =>   %s" % (item , cm_config[item]))

here are the error :

Traceback (most recent call last):
  File "./test.py", line 17, in <module>
    cm_config = api.get_cloudera_manager().get_config(view='full')
  File "build/bdist.linux-x86_64/egg/cm_api/endpoints/cms.py", line 115, in get_config
  File "build/bdist.linux-x86_64/egg/cm_api/endpoints/types.py", line 340, in _get_config

  File "build/bdist.linux-x86_64/egg/cm_api/resource.py", line 110, in get
  File "build/bdist.linux-x86_64/egg/cm_api/resource.py", line 73, in invoke
  File "build/bdist.linux-x86_64/egg/cm_api/http_client.py", line 174, in execute
cm_api.api_client.ApiException:  (error 403)

So I don't have any clue where the problem come from. What could it be ?

Thank you,

Ps : I user python cloudera API v 11.

Antoine
  • 355
  • 2
  • 12

2 Answers2

0

Can you validate user password? 403 error means forbidden

jedijs
  • 563
  • 5
  • 14
  • It works because I am able to get the cluster name when I do: for c in api.get_all_clusters(): print(c.name) – Antoine Mar 23 '17 at 17:18
  • Do you use kerberos? – jedijs Mar 24 '17 at 10:05
  • This code works on 4 clusters, and one of them use Kerberos. And the 3 others where it doesn't korws don't use Kerberos. So I guess it depends not on it. And After some tests, it works on one cluster on 5.8.3. So the problem does not come from the version; So I update my question. – Antoine Mar 24 '17 at 11:14
  • 1
    Can you test with curl? – jedijs Mar 24 '17 at 14:40
  • yes it works, I am able to get the configuration with myserver.server.lan/api/v11/cm/config?view=full – Antoine Mar 24 '17 at 14:53
0

I answer my own question: in fact, it come from the user right. I was not querying my different clusters with the same user. So my reading user is able to query :

  • the Services
  • the Group Roles
  • but not the Cloudera Manager Parameters !

it need an admin account to be able to query everything...

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Antoine
  • 355
  • 2
  • 12