cookbook

package
v0.5.2-pre3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 19, 2014 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package cookbook handles the basic building block of any chef (or goiardi) run, the humble cookbook.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DependsCookbooks

func DependsCookbooks(run_list []string, env_constraints map[string]string) (map[string]interface{}, error)

For the given run list and environment constraints, return the cookbook dependencies.

func GetList

func GetList() []string

Get a list of all cookbooks on this server.

Types

type Cookbook

type Cookbook struct {
	Name     string
	Versions map[string]*CookbookVersion
	// contains filtered or unexported fields
}

The Cookbook struct holds an array of cookbook versions, which is where the run lists, definitions, attributes, etc. are.

func AllCookbooks added in v0.5.0

func AllCookbooks() (cookbooks []*Cookbook)

Return all the cookbooks that have been uploaded to this server.

func Get

func Get(name string) (*Cookbook, util.Gerror)

Get a cookbook.

func New

func New(name string) (*Cookbook, util.Gerror)

Create a new cookbook.

func (*Cookbook) ConstrainedInfoHash

func (c *Cookbook) ConstrainedInfoHash(num_results interface{}, constraint string) map[string]interface{}

Gets num_results (or all if num_results is nil) versions of a cookbook that match the given constraint and returns a hash describing the cookbook and the versions returned.

func (*Cookbook) Delete

func (c *Cookbook) Delete() error

func (*Cookbook) DeleteVersion

func (c *Cookbook) DeleteVersion(cb_version string) util.Gerror

Delete a particular version of a cookbook.

func (*Cookbook) GetName

func (c *Cookbook) GetName() string

func (*Cookbook) GetVersion

func (c *Cookbook) GetVersion(cbVersion string) (*CookbookVersion, util.Gerror)

Get a particular version of the cookbook.

func (*Cookbook) InfoHash

func (c *Cookbook) InfoHash(num_results interface{}) map[string]interface{}

Gets num_results (or all if num_results is nil) versions of a cookbook, returning a hash describing the cookbook and the versions returned.

func (*Cookbook) LatestConstrained

func (c *Cookbook) LatestConstrained(constraint string) *CookbookVersion

Returns the latest version of a cookbook that matches the given constraint. If no constraint is given, returns the latest version.

func (*Cookbook) LatestVersion

func (c *Cookbook) LatestVersion() *CookbookVersion

Get the latest version of this cookbook.

func (*Cookbook) NewVersion

func (c *Cookbook) NewVersion(cb_version string, cbv_data map[string]interface{}) (*CookbookVersion, util.Gerror)

Create a new version of the cookbook.

func (*Cookbook) NumVersions added in v0.5.0

func (c *Cookbook) NumVersions() int

The number of versions this cookbook has.

func (*Cookbook) Save

func (c *Cookbook) Save() error

Save a cookbook to the in-memory data store or database.

func (*Cookbook) URLType

func (c *Cookbook) URLType() string

func (*Cookbook) UpdateLatestVersion

func (c *Cookbook) UpdateLatestVersion()

Update what the cookbook stores as the latest version available.

type CookbookVersion

type CookbookVersion struct {
	CookbookName string                   `json:"cookbook_name"`
	Name         string                   `json:"name"`
	Version      string                   `json:"version"`
	ChefType     string                   `json:"chef_type"`
	JsonClass    string                   `json:"json_class"`
	Definitions  []map[string]interface{} `json:"definitions"`
	Libraries    []map[string]interface{} `json:"libraries"`
	Attributes   []map[string]interface{} `json:"attributes"`
	Recipes      []map[string]interface{} `json:"recipes"`
	Providers    []map[string]interface{} `json:"providers"`
	Resources    []map[string]interface{} `json:"resources"`
	Templates    []map[string]interface{} `json:"templates"`
	RootFiles    []map[string]interface{} `json:"root_files"`
	Files        []map[string]interface{} `json:"files"`
	IsFrozen     bool                     `json:"frozen?"`
	Metadata     map[string]interface{}   `json:"metadata"`
	// contains filtered or unexported fields
}

CookbookVersion is the meat of the cookbook. This is what's set when a new cookbook is uploaded.

func (*CookbookVersion) GetName added in v0.5.1

func (c *CookbookVersion) GetName() string

func (*CookbookVersion) RecipeList

func (cbv *CookbookVersion) RecipeList() ([]string, util.Gerror)

Provide a list of recipes in this cookbook version.

func (*CookbookVersion) ToJson

func (cbv *CookbookVersion) ToJson(method string) map[string]interface{}

Helper function that coverts the internal representation of a cookbook version to JSON in a way that knife and chef-client expect.

func (*CookbookVersion) URLType added in v0.5.1

func (c *CookbookVersion) URLType() string

func (*CookbookVersion) UpdateVersion

func (cbv *CookbookVersion) UpdateVersion(cbv_data map[string]interface{}, force string) util.Gerror

Update a specific version of a cookbook.

type VersionStrings

type VersionStrings []string

Make version strings with the format "x.y.z" sortable.

func (VersionStrings) Len

func (v VersionStrings) Len() int

func (VersionStrings) Less

func (v VersionStrings) Less(i, j int) bool

func (VersionStrings) Swap

func (v VersionStrings) Swap(i, j int)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL