NAME
Pantry::Model::Pantry - Pantry data model for a pantry directory
VERSION
version 0.008
SYNOPSIS
my $pantry = Pantry::Model::Pantry->new;
my $node = $pantry->node("foo.example.com");
DESCRIPTION
Models a 'pantry' -- a directory containing files used to manage servers with Chef Solo by Opscode.
ATTRIBUTES
path
Path to the pantry directory. Defaults to the current directory.
METHODS
all_nodes
my @nodes = $pantry->all_nodes;
In list context, returns a list of nodes. In scalar context, returns a count of nodes.
node
my $node = $pantry->node("foo.example.com");
Returns a Pantry::Model::Node object corresponding to the given node. If the node exists in the pantry, it will be loaded from the saved node file. Otherwise, it will be created in memory (but will not be persisted to disk).
find_node
my @nodes = $pantry->find_node( $leading_part );
Finds one or more node matching a leading part. For example, given nodes 'foo.example.com' and 'bar.example.com' in a pantry, use <$pantry-
find_node("foo")>> to get 'foo.example.com'.
Returns a list of node objects if any are found.
all_roles
my @roles = $pantry->all_roles;
In list context, returns a list of roles. In scalar context, returns a count of roles.
role
my $node = $pantry->role("web");
Returns a Pantry::Model::Role object corresponding to the given role. If the role exists in the pantry, it will be loaded from the saved role file. Otherwise, it will be created in memory (but will not be persisted to disk).
find_role
my @roles = $pantry->find_role( $leading_part );
Finds one or more role matching a leading part. For example, given roles 'web' and 'mysql' in a pantry, use <$pantry-
find_role("my")>> to get 'mysql'.
Returns a list of role objects if any are found.
cookbook
my $node = $pantry->cookbook("myapp");
Returns a Pantry::Model::Cookbook object corresponding to the given cookbook.
AUTHOR
David Golden <dagolden@cpan.org>
COPYRIGHT AND LICENSE
This software is Copyright (c) 2011 by David Golden.
This is free software, licensed under:
The Apache License, Version 2.0, January 2004