All Projects → go-chef → chef

go-chef / chef

Licence: Apache-2.0, Unknown licenses found Licenses found Apache-2.0 LICENSE Unknown license.go
Chef-Server API client in golang

Programming Languages

go
31211 projects - #10 most used programming language
ruby
36898 projects - #4 most used programming language
shell
77523 projects

Projects that are alternatives of or similar to chef

Azure-WinRM-Terraform
Example Terraform plan for provisioning a Windows Server on Azure with WinRM
Stars: ✭ 19 (-75.64%)
Mutual labels:  chef
chef-selenium
Chef cookbook to install and configure Selenium
Stars: ✭ 17 (-78.21%)
Mutual labels:  chef
mac os x
This cookbook has been deprecated
Stars: ✭ 75 (-3.85%)
Mutual labels:  chef
masterclass-codeexamples
Code examples used in Get into DevOps: The Masterclass
Stars: ✭ 35 (-55.13%)
Mutual labels:  chef
delivery-truck
DEPRECATED: Delivery build cb for pipelines
Stars: ✭ 36 (-53.85%)
Mutual labels:  chef
github
Development repository for the github cookbook
Stars: ✭ 22 (-71.79%)
Mutual labels:  chef
chef-drone
Chef cookbook for Drone
Stars: ✭ 23 (-70.51%)
Mutual labels:  chef
memcached
Development repository for the memcached cookbook
Stars: ✭ 50 (-35.9%)
Mutual labels:  chef
omnibus
Prepares a machine to be an Omnibus builder. ┬──┬◡ノ(° -°ノ)
Stars: ✭ 28 (-64.1%)
Mutual labels:  chef
drbd
Development repository for the drbd cookbook
Stars: ✭ 19 (-75.64%)
Mutual labels:  chef
samba
Development repository for the samba cookbook
Stars: ✭ 30 (-61.54%)
Mutual labels:  chef
yum-epel
Development repository for the yum-epel cookbook
Stars: ✭ 23 (-70.51%)
Mutual labels:  chef
freebsd
Development repository for the freebsd cookbook
Stars: ✭ 27 (-65.38%)
Mutual labels:  chef
cookbook-cq
Chef cookbook for Adobe CQ (aka AEM)
Stars: ✭ 20 (-74.36%)
Mutual labels:  chef
selinux
Development repository for the selinux cookbook
Stars: ✭ 57 (-26.92%)
Mutual labels:  chef
fmw-chef-cookbook
Official repository of samples that show how to use Chef to provision Oracle Fusion Middleware (FMW) products.
Stars: ✭ 43 (-44.87%)
Mutual labels:  chef
chef-apache-hardening
dev-sec.io/
Stars: ✭ 24 (-69.23%)
Mutual labels:  chef
standalone-configuration-management
Basic examples of how to use each of chef, puppet, salt and ansible as standalone configuration management systems.
Stars: ✭ 14 (-82.05%)
Mutual labels:  chef
chef
Chef configuration management repo for configuring & maintaining the OpenStreetMap servers.
Stars: ✭ 94 (+20.51%)
Mutual labels:  chef
sssd ldap
Development repository for the sssd_ldap cookbook
Stars: ✭ 17 (-78.21%)
Mutual labels:  chef

Stories in Ready Build Status Coverage Status

Chef Server API Client Library in Golang

This is a Library that you can use to write tools to interact with the chef server.

Install

go get github.com/go-chef/chef

Test

go get -t github.com/go-chef/chef
go test -v github.com/go-chef/chef
test_chef_server: kitchen verify  # integration tests

SSL

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

Usage

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"
	"io/ioutil"
	"os"

	"github.com/go-chef/chef"
)

func main() {
	// read a client key
	key, err := ioutil.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)
}

Chef API Error Status

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.

  • Error() returns a formatted error message with the URL and status code.
  • StatusCode() returns the original return status code.
  • StatusMsg() returns the error message extracted from the error message body.
  • StatusText() returns the returned error message body, usually JSON.
  • StatusMethod() returns the name of the method used for the request.
  • StatusURL() returns the URL object used for the request.

CONTRIBUTING

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.

AUTHORS

Jesse Nelson @spheromak
AJ Christensen @fujin
Brad Beam @bradbeam
Kraig Amador @bigkraig
Mark Gibbons @mark

COPYRIGHT

Copyright 2013-2014, Jesse Nelson

LICENSE

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.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].