go-chef / chef Goto Github PK
View Code? Open in Web Editor NEWChef-Server API client in golang
Home Page: http://godoc.org/github.com/go-chef/chef
License: Apache License 2.0
Chef-Server API client in golang
Home Page: http://godoc.org/github.com/go-chef/chef
License: Apache License 2.0
no docs need docs
Node information can be viewed and managed, but the corresponding clients cannot. Can support for this be added?
Most of the services are implemented as a veneer over the Server API. Some services have higher level methods. I think we should maybe move these into a specific porcelain package. Open for input on this as well.
Need Sandbox service for proper object upload. Need to ensure the SignHeader / Auth stuff will work for sandbox.. might be another issue/test.
Lets get the Role Struct / Object worked out
Getting this error when invoking:
client.Nodes.List()
This link looks close to the issue: https://www.socketloop.com/tutorials/golang-invalid-character-looking-for-beginning-of-value
The function for deleting the cookbook is missing the version in the path name.
When invalid org is sent to chef-server bad things happen. We should just validate the BaseUrl at minimum has a trailing slash.
I have found a bug in the Cookbook struct where the RootFiles
is not
matched to the right field for json Marshaling/Unmashaling. Currently, it
is set to templates
when the real field we wanna map is root_files
.
is there a way to use this library to run a chef-zero run?
This func seems sorta WET think we can pull some of that repetition out.
Would be good to break out the client bits of http.go then each service into their own packages. The model with the service struct embedding a client should serve this right I think. where each service will require client, and that would require auth and http. dunno probably needs some exploration / spike time. Also up for whatever ideas people may have on this one.
Missing code to support the endpoint, tests, examples.
https://docs.chef.io/api_chef_server.html#license
I made a simple test that runs a search on available nodes in my chef server, and I noticed that the code crashes when I call chefClient.Search.Exec("node", "*.*)
. I am running on the latest stable version of Go
key, err := ioutil.ReadFile(chefKeyPath)
if err != nil {
log.Fatalf("Couldn't read chef key: %s", err.Error())
return
}
chefClient, err := chef.NewClient(&chef.Config{
Name: "mychefservername",
Key: string(key),
BaseURL: chefServerAddress,
})
if err != nil {
log.Fatalf("Couldn't connect to chef server: %s", err.Error())
return
}
resp, err := chefClient.Search.Exec("node", "*:*")
if err != nil {
log.Fatalf("Error executing query %s", err.Error())
return
}
Here is the crash dump:
https://docs.chef.io/api_chef_server.html#association-requests
Missing code to support association requests endpoints, tests, examples.
cc/ @spheromak
GetDataByName returns map[string][string] for simple values like {"key":"value"} but does not reutrn anything useful for somehting like
{
"key": {"otherkey": "othervalue"}
}
Hi.
Is there a way to specify a policy instead of a run-list when creating/editing a node ?
Thanks,
Léo.
Enhancement:
current role.go code has a placeholder for role delete functionality but was not implemented. I"ve the code ready. I'll write the test code as well and submit a pull request.
Hi!
The Debian build of go-chef/chef runs the test suite, and it has been found that it randomly fails.
=== RUN TestClientsService_List
--- FAIL: TestClientsService_List (0.01s)
client_test.go:47: Clients.List returned:
client1 => http://localhost/clients/client1
client2 => http://localhost/clients/client2
want:
client1 => http://localhost/clients/client1
client2 => http://localhost/clients/client2
or
=== RUN TestDataBagsService_DataBagListResultString
--- FAIL: TestDataBagsService_DataBagListResultString (0.00s)
databag_test.go:162: DataBagListResult.String returned:
bag1 => http://localhost/data/bag1
bag2 => http://localhost/data/bag2
want:
bag1 => http://localhost/data/bag1
bag2 => http://localhost/data/bag2
I can provide more info on request.
http hardcodes content-type header to json. This is problematic if you want to call a chef.Do for sandbox file uploads (even tho they aren't always on a chef-server).
Adding richer errors and error types for all the services where it makes sense. Internally in http possibly as well.
@MarkGibbons Just want to say thanks. I've not been able to put much time at all into this the last couple years, and glad you have taken it up with gusto.
From documentation
274 // Caller should close resp.Body when done reading from it.
Whereas the code here:
Line 220 in 3abaf6b
This leads to the host system Maxing out on Open File Descriptors if the ulimit is fairly low. In my case it was 256.
I can do a PR, but that would require a substantial amount of change, and If you guys don't have this on your priority list, I can take it up.
RunList type currently has no GoDoc whatsoever.
Need to add Node.Post
the DataBag service isn't 100% complete.
We recently went back to privateDecrypt (and using the other side from Goiardi) which is as I understand it, authentication protocol 1.0, and 1.1 (?).
We should support v1.2 explicitly, hopefully with rsa.Sign/Verify fucntions, with half from Goiardi (for tests) and prefer it where possible.
Need to get a cookbook Object worked out
Missing code to support the end point, tests and examples.
https://docs.chef.io/api_chef_server.html#authenticate-user
Hi,
What is the difference between this package and https://github.com/marpaia/chef-golang by @marpaia? Do they exist to serve two different needs, or are you unaware of two similar efforts?
Which one should people use?
Thanks.
The current tester job works for my repository, doesn't work for go-test/chef. It's failing in the gofmt checks. See if the circleci jobs are set up differently.
We want to provide porcelain around creating http Request which has its headers handled by SignRequest!
We should probably do client-side gzip, too. ;-)
Originated from chef/chef-analyze#20
As a go-chef user,
I would like to have the ability to download cookbooks from a Chef Server,
So I can have cookbooks locally on disk to read and/or to implement this
functionality internally on other Go programs/libraries.
Missing code to support the end points, tests, examples
https://docs.chef.io/api_chef_server.html#users-user-keys
https://docs.chef.io/api_chef_server.html#users-user-keys-key
I'm hoping to use Environments.List to simply list all of the environments.
It appears that the EnvironmentsResult object is of the type map[string]string
However when I attempt to access it via:
environments, err := client.Environments.List()
fmt.Println(environments["foo"])
I get this error
"invalid operation: environments["foo"] (type *chef.EnvironmentResult does not support indexing)"
I am new to go so maybe I am not using correctly.
Is EnvironmentsResult not a map?
We should setup some test scenarios using chef-platform and a go-chef org or something like this. Would be really good to get some code running through all of that.
As it is, there is no way to modify the TLSClientConfig on the http.Client. It'd be nice to be able to enable InsecureSkipVerify for Chef servers with self signed certificates.
https://docs.chef.io/api_chef_server.html#status
Missing code to support the /_status end point, tests, examples
idea to get rid of the magicRequest * is to maybe build up an interface thats a chef-request ? not sure if thats the best way to do it or not.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.