pychef | Python library to interact with the Chef server API
kandi X-RAY | pychef Summary
kandi X-RAY | pychef Summary
Python library to interact with the Chef server API
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Return a dict of all chef roles
- Return an instance of the chef API
- Return the configured API
- Load configuration from a config file
- Create a new instance of a bag
- Make a request to the API
- Make a HTTP request
- Query chef tags
- Generates a function that returns a chef query
- Save the configuration to the Chef server
- Return a merged dictionary
- Create an object from a search response
- Create a new instance from an error
- Reload ace attributes
- List all available servers
- Return the global api
- Create a Chef instance
- Create a new Chef instance
- Save this instance
- Populate the node attributes
- Create an instance from a JSON dictionary
- Populates the object attributes from the data dict
- Return the object of the object
- Create a chef environment
- Load the RSA key
- Return a dict representation of the client
pychef Key Features
pychef Examples and Code Snippets
for nodes in $(knife node list); do knife node show $nodes -r; done
for nodes in $(knife node list); do knife node show $nodes -r | grep COOKBOOK; done
Community Discussions
Trending Discussions on pychef
QUESTION
I am trying to pull chef-client runs details. We are using PyChef currently and able to get information on the list of nodes connected with the Chef Server and its corresponding run_list. Is there an option in PyChef to get information on the client runs (start time, end time, status of the run, etc)
Used the following code:
...ANSWER
Answered 2017-Sep-12 at 15:39By default Chef Server does not save that information. It is part of the older Chef Reporting commercial addon and the newer Chef Automate system. As I've never used either, there is no direct API support for those in PyChef but you can always use the raw API object to make simple requests yourself. For example, looking at https://docs.chef.io/api_reporting.html#reports-nodes-node-runs you could use api['/reports/nodes/foo.example.com/runs']
to get a list of the run IDs for that node.
QUESTION
I am trying to authenticate with chef api. To authenticate with chef api i need to pass in pem file, user and certificate. How can i pass that using requests module.
Below is what i am trying
...ANSWER
Answered 2019-Jun-19 at 08:13try pychef by coderanger or you can get an inspiration from chef-api
QUESTION
I'd like to start using pyChef but my dev environment has a self-signed certificate, so I keep getting an SSL error due to 'SSL: CERTIFICATE_VERIFY_FAILED'.
I see that chef.ChefAPI allows for ssl_verify=False, but does not work when using within chef.autoconfigure(). Can I auto-configure ssl verification?
I would like to make this script require no manual configuration from the user, how do I disable SSL verification using chef.autoconfigure(), or do I need to still need to call chef.ChefAPI on each query (or set default) and disable it there?
Maybe there are potential workarounds in Python as well to call the cert?
...ANSWER
Answered 2018-Jan-23 at 20:30I didn't make that easy since I think disabling TLS should be an absolute last resort. If you're using a self-signed cert, you can do the normal thing of setting the $SSL_CERT_FILE
environment variable to the certificate path. But if you must:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install pychef
You can use pychef like any standard Python library. You will need to make sure that you have a development environment consisting of a Python distribution including header files, a compiler, pip, and git installed. Make sure that your pip, setuptools, and wheel are up to date. When using pip it is generally recommended to install packages in a virtual environment to avoid changes to the system.
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page