New Contributor
Posts: 1
Registered: ‎03-30-2018

Use Encrypted password for Cloudera Manager ApiResource instead of cleartext password

am trying to use an encrypted password in the python script for Cloudera Backup Disaster Recovery using Cloudera Manager API.

This is the BDR script i am trying to run:

When i am hard coding the password


it is working. But when i am trying to assign to a variable(var_passwprd="xyz") and then passing the variable to the password


it is throwing below error:

Traceback (most recent call last): 
 File "", line 41, in <module> 
target_cluster = target_api.get_cluster('QA') 
File "/opt/pythonvirtual/bdr/lib/python2.7/site-
packages/cm_api/", line 140, in get_cluster return clusters.get_cluster(self, name) 
File "/opt/pythonvirtual/bdr/lib/python2.7/site-
packages/cm_api/endpoints/", line 57, in get_cluster return call(resource_root.get, "%s/%s" % (CLUSTERS_PATH, name), ApiCluster) 
File "/opt/pythonvirtual/bdr/lib/python2.7/site-
packages/cm_api/endpoints/", line 139, in call 
ret = method(path, params=params) 
File "/opt/pythonvirtual/bdr/lib/python2.7/site-
packages/cm_api/", line 110, in get return self.invoke("GET", relpath, params) 
File "/opt/pythonvirtual/bdr/lib/python2.7/site-
packages/cm_api/", line 73, in invoke 
File "/opt/pythonvirtual/bdr/lib/python2.7/site-
packages/cm_api/", line 183, in execute raise self._exc_class(ex) 
cm_api.api_client.ApiException: <html> 
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/> 
<title>Error 401 Bad credentials</title> 
<body><h2>HTTP ERROR 401</h2> 
<p>Problem accessing /api/v16/clusters/QA. Reason: 
<pre>    Bad credentials</pre></p><hr /><i><small>Powered by Jetty://</small></i><br/> 
(error 401)