Created on 07-17-2016 06:15 AM - edited 09-16-2022 03:30 AM
Hi,
im trying to Import the KDC Account Manager credentials with REST API call without any success
i'm running the following command:
curl -X POST -u "admin:admin" -i \ -H "Content-Type:application/json" \ -d '{"items": [ { "username": "cloudera-scm/admin@<HOSTNAME>.KERBEROS.COM" , "password": "<PASS>" } ] }' \ http://localhost:7180/api/v11/cm/commands/importAdminCredentials
and i'm getting the error below in cloudera-scm-server.log:
2016-07-17 15:42:09,032 INFO 1919433329@scm-web-78:com.cloudera.server.web.cmf.AuthenticationSuccessEventListener: Authentication success for user: 'admin' from 127.0.0.1 2016-07-17 15:42:09,040 INFO 1919433329@scm-web-78:com.cloudera.cmf.service.ServiceHandlerRegistry: Executing command ImportCredentials with sensitive arguments. 2016-07-17 15:42:14,066 ERROR CommandPusher:com.cloudera.cmf.command.CommandHelpers: ImportCredentials - Execution error: java.lang.NullPointerException at java.lang.ProcessBuilder.start(ProcessBuilder.java:1010) at com.cloudera.cmf.security.ImportCredentialsCommand.generateKeytab(ImportCredentialsCommand.java:174) at com.cloudera.cmf.security.ImportCredentialsCommand.access$400(ImportCredentialsCommand.java:49) at com.cloudera.cmf.security.ImportCredentialsCommand$2$1.run(ImportCredentialsCommand.java:210) at com.cloudera.cmf.security.ImportCredentialsCommand$2$1.run(ImportCredentialsCommand.java:202) at com.cloudera.cmf.security.components.SecurityUtils.runWithGenerateKrb5Conf(SecurityUtils.java:334) at com.cloudera.cmf.security.ImportCredentialsCommand$2.call(ImportCredentialsCommand.java:202) at com.cloudera.cmf.security.ImportCredentialsCommand$2.call(ImportCredentialsCommand.java:198) at java.util.concurrent.FutureTask.run(FutureTask.java:262) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:745) 2016-07-17 15:42:14,067 INFO CommandPusher:com.cloudera.cmf.model.DbCommand: Command 197(ImportCredentials) has completed. finalstate:FINISHED, success:false, msg:null
when i'm running the same process from Cloudera manager UI it passed seccessfully
Please advice
Created 07-22-2016 06:43 AM
The POST command on the API you're using [1] requires passing the username and password as query parameters, not as a JSON object in the request body.
Try something like this instead:
~> curl -X POST -u "admin:admin" -i 'http://localhost:7180/api/v11/cm/commands/importAdminCredentials?username=user/admin@REALM&password=your-password'
The type of parameter expected is noted in the column on the table in the link above. You need to use JSON request bodies if and only if the POST description requires such a structure, for example for this request [2] (notice the two parameters, plus an additional request body data structure).
Created 07-22-2016 06:43 AM
The POST command on the API you're using [1] requires passing the username and password as query parameters, not as a JSON object in the request body.
Try something like this instead:
~> curl -X POST -u "admin:admin" -i 'http://localhost:7180/api/v11/cm/commands/importAdminCredentials?username=user/admin@REALM&password=your-password'
The type of parameter expected is noted in the column on the table in the link above. You need to use JSON request bodies if and only if the POST description requires such a structure, for example for this request [2] (notice the two parameters, plus an additional request body data structure).
Created 07-24-2016 01:43 AM
Thank you Harsh - it worked perfect