[chef] Re: RE: Re: Chef Server API Call and Docs


Chronological Thread 
  • From: Mark Mzyk < >
  • To:
  • Subject: [chef] Re: RE: Re: Chef Server API Call and Docs
  • Date: Mon, 17 Nov 2014 14:49:32 -0500

Hello Dan,

You're right in that there is a superuser you're not aware of. It's called the pivotal user and it's setup when you create your Chef server. It's primary function is to be used by Manage, the WebUI, to be able to make calls to do things like you're doing and setup organizations. A normal user in the system does not have access to do this.

The chef-server-ctl org-create and related commands also make user of the pivotal user in this way. In fact, the chef-server-ctl commands are currently just a wrapper over knife-opc (which stands for knife opscode private chef, a bit outdated in its naming now). knife-opc is a knife addon that when configured with the pivotal user can perform cross organization calls.

If you want to look at knife-opc as an example of what it's doing, it is open source and can be found here: https://github.com/opscode/knife-opc

Thanks,

Mark Mzyk


" type="cite">
" photoname="Daniel Klopp" src="jpgK1eSCzkPGE.jpg" name="compose-unknown-contact.jpg" height="25px" width="25px">
November 17, 2014 at 12:00 PM
12.0.0-rc.5

-Dan

From: James Scott [ "> ]
Sent: Monday, November 17, 2014 8:53 AM
To: ">
Subject: [chef] Re: Chef Server API Call and Docs

Which version of the Chef server are you using?


" photoname="Daniel Klopp" src="jpgK1eSCzkPGE.jpg" name="compose-unknown-contact.jpg" height="25px" width="25px">
November 17, 2014 at 11:48 AM
Hello,

I am using https://docs.getchef.com/api_chef_server.html as a reference point for generating HTTP API calls against the Chef Server.  The tasks I am trying to accomplish are chiefly programmatic creation and querying of organizations and users.  When I follow the examples on that page I think there is an error, or unspoken assumptions.  From https://docs.getchef.com/server_orgs.html , a user is contained within an organization.  But the API docs are referencing accessing the root of all organizations with a user.  Which one is right?  Or is there a "superuser" I do not know of?

For example, the API docs reference making calls against "/organizations" for a list of organizations.  When I try to do this I get a 404 error.  But if I query my organization as "/organizations/dantestshort", then all is good.  The current code I am using (IP Addresses modified):

require 'rubygems'
require 'chef/config'
require 'chef/log'
require 'chef/rest'
require 'chef'
# Not real IP Address
chef_server_url="https://1.2.3.4:443/organizations/dantestshort"
Chef::Config.from_file(".chef/knife.rb")
rest = Chef::REST.new(chef_server_url)
nodes = rest.get_rest("/cookbooks")

nodes.each do |node|
        puts node
end


What am I doing wrong?
-Dan


This communication is Confidential Information. By using this message and attachments you implicitly consent to terms and conditions set forth at http://www.taos.com/email_disclaimer. If you do not consent or received this message in error, please destroy it.



Archive powered by MHonArc 2.6.16.

§