
Security News
ECMAScript 2025 Finalized with Iterator Helpers, Set Methods, RegExp.escape, and More
ECMAScript 2025 introduces Iterator Helpers, Set methods, JSON modules, and more in its latest spec update approved by Ecma in June 2025.
github.com/go-chef/chef
This is a Library that you can use to write tools to interact with the chef server.
go get github.com/go-chef/chef
go get -t github.com/go-chef/chef
go test -v github.com/go-chef/chef
test_chef_server: kitchen verify # integration tests
If you run into an SSL verification problem when trying to connect to a ssl server with self signed certs set up your config object with SkipSSL: true
This example is setting up a basic client that you can use to interact with all the service endpoints (clients, nodes, cookbooks, etc. At @chefapi) More usage examples can be found in the examples directory.
package main
import (
"fmt"
"os"
"github.com/go-chef/chef"
)
func main() {
// read a client key
key, err := os.ReadFile("key.pem")
if err != nil {
fmt.Println("Couldn't read key.pem:", err)
os.Exit(1)
}
// build a client
client, err := chef.NewClient(&chef.Config{
Name: "foo",
Key: string(key),
// goiardi is on port 4545 by default. chef-zero is 8889
BaseURL: "http://localhost:4545",
})
if err != nil {
fmt.Println("Issue setting up client:", err)
}
// List Cookbooks
cookList, err := client.Cookbooks.List()
if err != nil {
fmt.Println("Issue listing cookbooks:", err)
}
// Print out the list
fmt.Println(cookList)
}
To get the error status and error message returned from calls to the Chef API Server you can use ChefError to unwind the ErrorResponse and access the original http error. These methods are available to get specific information from the the error.
If you feel like contributing, great! Just fork the repo, make your improvements, and submit a pull request. Tests would, of course, be appreciated. Adding tests where there are no tests currently would be even more appreciated. At least, though, try and not break anything worse than it is. Test coverage has improved, but is still an ongoing concern.
Jesse Nelson | @spheromak |
AJ Christensen | @fujin |
Brad Beam | @bradbeam |
Kraig Amador | @bigkraig |
Mark Gibbons | @mark |
Copyright 2013-2014, Jesse Nelson
Like many Chef ecosystem programs, go-chef/chef is licensed under the Apache 2.0 License. See the LICENSE file for details.
Chef is copyright (c) 2008-2014 Chef, Inc. and its various contributors.
Thanks go out to the fine folks of Opscode and the Chef community for all their hard work.
FAQs
Unknown package
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
ECMAScript 2025 introduces Iterator Helpers, Set methods, JSON modules, and more in its latest spec update approved by Ecma in June 2025.
Security News
A new Node.js homepage button linking to paid support for EOL versions has sparked a heated discussion among contributors and the wider community.
Research
North Korean threat actors linked to the Contagious Interview campaign return with 35 new malicious npm packages using a stealthy multi-stage malware loader.