coderanger/pychef — pull request #20 by gmr (2013-07-20 07:12:29+00:00)
Title: Add cookbook support

This adds a class for dealing with cookbooks. Unfortunately an annoying nit is that due to the class level attributes attribute, we can not use the attributes attribute for cookbook attributes.

Please let me know if you want anything else for inclusion.

Examples:

>>> for cookbook in chef.Cookbook.list():
... print cookbook
...
build-essential
riak-ssl
meetme-service
sysctl
runit

>>> chef.Cookbook.versions('mycookbook')
[u'0.8.5', u'0.8.6', u'0.8.7', u'0.8.8', u'0.9.0', u'0.9.1', u'0.9.10', u'0.9.11', u'0.9.12', u'0.9.13', u'0.9.2', u'0.9.3', u'0.9.4', u'0.9.5', u'0.9.6', u'0.9.7', u'0.9.8', u'0.9.9']

>>> c = chef.Cookbook('rabbitmq')
>>> c.metadata
{u'conflicting': {}, u'maintainer': u'Opscode, Inc.', u'description': u'Installs and configures RabbitMQ server', u'replacing': {}, u'suggestions': {}, u'maintainer_email': u'cookbooks@opscode.com', u'platforms': {u'scientific': u'>= 0.0.0', u'centos': u'>= 0.0.0', u'amazon': u'>= 0.0.0', u'smartos': u'>= 0.0.0', u'linuxmint': u'>= 0.0.0', u'redhat': u'>= 0.0.0', u'ubuntu': u'>= 0.0.0', u'oracle': u'>= 0.0.0', u'debian': u'>= 0.0.0', u'fedora': u'>= 0.0.0'}, u'dependencies': {u'erlang': u'>= 0.9'}, ...