Pantry::Model::Pantry - Pantry data model for a pantry directory
version 0.012
my $pantry = Pantry::Model::Pantry->new; my $node = $pantry->node("foo.example.com");
Models a 'pantry' -- a directory containing files used to manage servers with Chef Solo by Opscode.
path
Path to the pantry directory. Defaults to the current directory.
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).
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'.
<$pantry-
Returns a list of node objects if any are found.
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).
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.
my @environments = $pantry->all_environments;
In list context, returns a list of environments. In scalar context, returns a count of environments.
environment
my $node = $pantry->environment("staging");
Returns a Pantry::Model::Environment object corresponding to the given environment.
my @environments = $pantry->find_environment( $leading_part );
Finds one or more environment matching a leading part. For example, given environments 'test' and 'staging' in a pantry, use <$pantry-find_environment('sta')>> to get 'staging'.
Returns a list of environment objects if any are found.
cookbook
my $node = $pantry->cookbook("myapp");
Returns a Pantry::Model::Cookbook object corresponding to the given cookbook.
my @bags = $pantry->all_bags;
In list context, returns a list of bags. In scalar context, returns a count of bags.
bag
my $node = $pantry->bag("xdg");
Returns a Pantry::Model::DataBag object corresponding to the given bag. If the bag exists in the pantry, it will be loaded from the saved bag file. Otherwise, it will be created in memory (but will not be persisted to disk).
my @bags = $pantry->find_bag( $leading_part );
Finds one or more bag matching a leading part. For example, given bags 'web' and 'mysql' in a pantry, use <$pantry-find_bag("my")>> to get 'mysql'.
Returns a list of bag objects if any are found.
David Golden <dagolden@cpan.org>
This software is Copyright (c) 2011 by David Golden.
This is free software, licensed under:
The Apache License, Version 2.0, January 2004
To install Pantry, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Pantry
CPAN shell
perl -MCPAN -e shell install Pantry
For more information on module installation, please visit the detailed CPAN module installation guide.