Pantry::Model::Node - Pantry data model for nodes
version 0.012
my $pantry = Pantry::Model::Pantry->new; my $node = $pantry->node("foo.example.com"); $node->append_to_run_list('recipe[nginx]'); $node->set_attribute('nginx.port' => 80); $node->save;
Models the configuration data for a specific server.
This attribute is the canonical name of the node, generally a fully-qualified domain name
This attribute is the name of the environment to which the node belongs. This defaults to _default.
_default
This attribute is provided by the Pantry::Role::Runlist role and holds a list of recipes (or roles) to be configured by chef-solo.
chef-solo
This attribute holds node attribute data as key-value pairs. Keys may be separated by a period to indicate nesting (literal periods must be escaped by a backslash). Values should be scalars or array references, except for boolean values which should be set as JSON::Boolean values like JSON::true and JSON::false.
JSON::true
JSON::false
This optional attribute holds an alternate hostname or IP address to use for the SSH connection within pantry sync. In all other respects, the node will still be referenced by the name attribute.
pantry sync
name
This optional attribute holds an alternate port number to use for the SSH connection within pantry sync.
This optional attribute holds an alternate user for the SSH connection within pantry sync. (The default is root.) This user must have password-less sudo permissions.
root
$node->set_attribute("nginx.port", 80);
Sets the node attribute for the given key to the given value.
my $port = $node->get_attribute("nginx.port");
Returns the node attribute for the given key.
$node->delete_attribute("nginx.port");
Deletes the node attribute for the given key.
Saves the node to a file in the pantry. If the private _path attribute has not been set, an exception is thrown.
_path
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.