0

we have Ambari cluster Version 2.5.0.3 , while all clients machines are Linux redhat

first I generated the json file to my Linux machine as the following: ( on ambari server machine )

 curl -H "X-Requested-By: ambari" -X GET -u admin:admin http://130.14.6.28:8080/api/v1/clusters/HDP01\?format\=blueprint > blueprint.json

then I update the blueprint.json file with some changes about the parameters and their values

finally my target is to upload the new blueprint.json to ambari cluster in order to take affect !

path=/root

curl -H "X-Requested-By: ambari" --data @ -X POST -u admin:admin http://130.14.6.28:8080/api/v1/blueprints/HDP01 -d @$path/blueprint.json

but I get the following errors ( seems because wrong syntax )

Warning: Couldn't read data from file "", this makes an empty POST. { 
"status" : 400, "message" : "Invalid Request: Malformed Request Body. An 
exception occurred parsing the request body: Unexpected character ('&' 
(code 38)): expected a valid value (number, String, array, object, 'true', 
'false' or 'null')\n at [Source: java.io.StringReader@4a3484a6; line: 1, 
column: 3]"

please advice what is wrong in my syntax ?

And what is the right syntax in order to upload the new update blueprint.json file

King David
  • 500
  • 1
  • 7
  • 20

2 Answers2

0

Did you try to validate your JSON online e.g. at https://jsonformatter.curiousconcept.com/ ? Looks like the problem is with general JSON syntax

Dmitriusan
  • 11,525
  • 3
  • 38
  • 38
0

In curl command used to upload new bloueprint.json, you are using --data @ as well as -d @$path/blueprint.json. -d and --data are used for same purpose hence first occurance i.e. --data @ takes effect and command tried to locate file with no path i.e. "".

You may remove --data @ to fix Couldn't read data from file "" error.

Shubhangi
  • 2,229
  • 2
  • 14
  • 14