Support Questions

Find answers, ask questions, and share your expertise
Announcements
Celebrating as our community reaches 100,000 members! Thank you!

Ambari Create Blueprint -- 405 Method Not Allowed

avatar
Explorer

Hi, I am just trying to automate the deployment using blueprints.

Step 1, I am exporting blueprint of my existing cluster by invoking below url

HTTP Get

http://<ambariserverhost>:8080/api/v1/clusters/:<myclusterName>?format=blueprint

Using basic authentication with ambari console admin user and password

Step 2, I am trying the register this exported blueprint to ambari. The url I try to post is,

http://<ambariserverhost>:8080/api/v1/blueprints/:testblueprint

And then I got the exception of "405 Method Not Allowed"

What could be the possible reason? I also tried to post the same body to another ambari which the cluster has not been created, same exception. (because I want to confirm that it's not because when I tried to register the blue print, I've already got an existing cluster).

1 ACCEPTED SOLUTION

avatar
Master Mentor

@Rachel Rui Liu

Why do you have an extra : colon in the step2 url ? (here: /api/v1/blueprint/:testblueprint )

Ideally the HTTP method should be "POST" and the post url should be something like following:

# curl -H "X-Requested-By: ambari" -X POST -u admin:admin http://<ambari-hostname>:8080/api/v1/blueprints/<blueprint-name>; -d @cluster_configuration.json

Example:

# curl -H "X-Requested-By: ambari" -X POST -u admin:admin http://erie1.example.com:8080/api/v1/blueprints/testblueprint -d @/PATH/TO/cluster_configuration.json

.

More details: https://community.hortonworks.com/articles/47170/automate-hdp-installation-using-ambari-blueprints.h...

View solution in original post

2 REPLIES 2

avatar
Master Mentor

@Rachel Rui Liu

Why do you have an extra : colon in the step2 url ? (here: /api/v1/blueprint/:testblueprint )

Ideally the HTTP method should be "POST" and the post url should be something like following:

# curl -H "X-Requested-By: ambari" -X POST -u admin:admin http://<ambari-hostname>:8080/api/v1/blueprints/<blueprint-name>; -d @cluster_configuration.json

Example:

# curl -H "X-Requested-By: ambari" -X POST -u admin:admin http://erie1.example.com:8080/api/v1/blueprints/testblueprint -d @/PATH/TO/cluster_configuration.json

.

More details: https://community.hortonworks.com/articles/47170/automate-hdp-installation-using-ambari-blueprints.h...

avatar
Explorer

Hi, Jay, thanks for your reply. Problem solved using curl and change the payload a little bit.

I followed the instruction documented at,

https://cwiki.apache.org/confluence/display/AMBARI/Blueprints

And I noticed the difference when I switching the tools.

When using Postman,

I have to add ":" when trigger the GET request to get blueprint, so my url is like

http://testambarihost:8080/api/v1/clusters/:mycluster?format=blueprint

And if I change the url to

http://testambarihost:8080/api/v1/clusters/mycluster?format=blueprint

I will get below exception

{ "status" : 404, "message" : "The requested resource doesn't exist: Cluster not found, clusterName=mycluster" }

When using curl,

no ":" is needed, and the post request you've mentioned works.

BTW, another modification I found required, the response body I get from step one, I need to manually remove the top level wrapper which wraps the blueprint as array items, after removing the top level wrapper of the body, I can post without issue.