We are faced with a third party application authorization
(written in Rails) to chef-server. In particular: it is necessary to
establish the role of our application. According to the documentation we
create a POST query of the form:
And we have nothing. Somehow we have to create a header that
will contain the signature, but it is unclear how to do it.
Question:
how to log-in to chef-server and create role normally?
We are faced with a third party application authorization (written in Rails)
to chef-server. In particular: it is necessary to establish the role of our
application. According to the documentation we create a POST query of the
form:
And we have nothing. Somehow we have to create a header that will contain
the signature, but it is unclear how to do it.
Question: how to log-in to chef-server and create role normally?
Hello! We are faced with a third party application
authorization (written in Rails) to chef-server. In particular: it is
necessary to establish the role of our application. According to the
documentation we create a POST query of the form: { "name": "123",
"chef_type": "role", "json_class": "Chef:: Role" } But the server does
not transmit the request, because we are not authorized on it. We're
trying to login (so in the documentation) on the server as:
chef_server_url = "http://10.1.6.106:4000" client_name = "desktop"
signing_ket_filename = "/ etc / chef / client.pem" rest = Chef::
REST.new (chef_server_url, client_name, signing_ket_filename) puts
rest.get_rest ("/ clients") And we have nothing. Somehow we have to
create a header that will contain the signature, but it is unclear how
to do it. Question: how to log-in to chef-server and create role
normally? -- Best Regards, Ilya
On Wednesday, December 7, 2011 at 4:05 AM, Ilya Maltsev wrote:
Spice log on POST query:
--- &id001 !str
str: "{"error":["undefined method `name' for nil:NilClass"]}"
Looks like you're missing quite a few fields in the JSON you post to the server. I'd consider it a bug that this doesn't return a 400 with a description of which fields are missing.
Anyway, you can play with this stuff in shef:
chef > new_role = Chef::Role.new
=> role
chef > new_role.name("my-new-role")
=> "my-new-role"
chef > new_role.to_json
=> "{"name":"my-new-role","description":"","json_class":"Chef::Role","default_attributes":{},"override_attributes":{},"chef_type":"role","run_list":,"env_run_lists":{}}"
Hello! Thank you.
And how to send this json? we don't understand, sorry.
On Срд, 2011-12-07 at 09:01 -0800, Daniel DeLeo wrote:
On Wednesday, December 7, 2011 at 4:05 AM, Ilya Maltsev wrote:
Spice log on POST query:
--- &id001 !str
str: "{"error":["undefined method `name' for nil:NilClass"]}"
Looks like you're missing quite a few fields in the JSON you post to the server. I'd consider it a bug that this doesn't return a 400 with a description of which fields are missing.
Anyway, you can play with this stuff in shef:
chef > new_role = Chef::Role.new
=> role
chef > new_role.name("my-new-role")
=> "my-new-role"
chef > new_role.to_json
=> "{"name":"my-new-role","description":"","json_class":"Chef::Role","default_attributes":{},"override_attributes":{},"chef_type":"role","run_list":,"env_run_lists":{}}"
issue has been resolved! everything was very simple :
new_role.save
it's all!
Thank you very much for your help!
On Thu,
08 Dec 2011 10:36:38 +0400, Ilya Maltsev wrote:
Hello! Thank you.
And how to send this json? we don't understand, sorry.
On Срд,
2011-12-07 at 09:01 -0800, Daniel DeLeo wrote:
On Wednesday,
December 7, 2011 at 4:05 AM, Ilya Maltsev wrote:
Spice log on
POST query:
--- &id001 !str
str: "{"error":["undefined
method `name' for nil:NilClass"]}"
Looks like you're missing
quite a few fields in the JSON you post to the server. I'd consider it a
bug that this doesn't return a 400 with a description of which fields
are missing.
Anyway, you can play with this stuff in shef:
chef > new_role = Chef::Role.new
=> role
chef >
new_role.name("my-new-role")
=> "my-new-role"
chef >
new_role.to_json
=>
"{"name":"my-new-role","description":"","json_class":"Chef::Role","default_attributes":{},"override_attributes":{},"chef_type":"role","run_list":,"env_run_lists":{}}"