###
### Copyright 2000-2007 University of Illinois Board of Trustees
### All rights reserved.
###
### PostgreSQL.pm - PostgreSQL module for psgconf
###
### Campus Information Technologies and Educational Services
### University of Illinois at Urbana-Champaign
###
package PSGConf::Control::PostgreSQL;
use strict;
use PSGConf::Data::Boolean;
use PSGConf::Data::List;
use PSGConf::Control::Packages qw(_add_pkgs);
use PSGConf::Control::syslog qw(_add_syslog);
###############################################################################
### policy methods
###############################################################################
sub _policy_add_kernel_params
{
my ($self, $psgconf) = @_;
return
if ($psgconf->data_obj('postgresql_enable')->equals('false'));
if ($psgconf->data_obj('platform')->match('solaris'))
{
$psgconf->data_obj('system_vars')->insert(
{ 'shmsys:shminfo_shmmax' => 2097152 }
) if (! defined $psgconf->data_obj('system_vars')->find('shmsys:shminfo_shmmax'));
$psgconf->data_obj('system_vars')->insert(
{ 'shmsys:shminfo_shmmin' => 1 }
) if (! defined $psgconf->data_obj('system_vars')->find('shmsys:shminfo_shmmin'));
}
}
sub _policy_add_syslog
{
my ($self, $psgconf) = @_;
$self->{facility} = $psgconf->data_obj('postgresql_syslog')->get();
return $self->_add_syslog($psgconf);
}
###############################################################################
### Constructor
###############################################################################
sub new
{
my ($class, $psgconf) = @_;
my ($self);
$self = {};
bless($self, $class);
### So that _add_pkgs knows which directives to look at
$self->{name} = 'postgresql';
$self->{enable} = $self->{name} . '_enable';
$self->{packages} = $self->{name} . '_packages';
$self->{syslog} = 'postgres';
$psgconf->register_data(
postgresql_enable => PSGConf::Data::Boolean->new(
value => 'false'
),
postgresql_syslog => PSGConf::Data::String->new(
value => 'local2.info'
),
postgresql_packages => PSGConf::Data::List->new()
);
$psgconf->register_policy($self,
pgsql_add_kernel_params => '_policy_add_kernel_params',
pgsql_add_syslog => '_policy_add_syslog',
pgsql_add_packages => '_add_pkgs'
);
return $self;
}
###############################################################################
### documentation
###############################################################################
1;
__END__
=head1 NAME
PSGConf::Control::PostgreSQL - psgconf control class for PostgreSQL
=head1 SYNOPSIS
In F<psgconf_modules>:
Control PSGConf::Control::PostgreSQL
=head1 DESCRIPTION
The B<PSGConf::Control::PostgreSQL> module provides a B<psgconf> control object
for configuring PostgreSQL. It supports the following methods:
=over 4
=item new()
The constructor. Its parameter is a reference to the B<PSGConf>
object. It registers the following data objects:
=over 4
=item I<posgresql_enable>
A B<PSGConf::Data::Boolean> object indicating whether B<postgreSQL> should
be configured.
=item I<postgresql_packages>
A B<PSGConf::Data::List> object listing all packages that need to be installed.
=item I<postgresql_syslog>
A B<PSGConf::Data::String> object containing the default syslog facility
the application logs to. Default is C<local2.info>.
=back
The constructor also registers the following policy methods:
=over 4
=item I<pgsql_add_packages>
Adds C<postgresql_packages> to the I<pkg_install_list> data object (which is
supplied by the B<PSGConf::Control::Packages> module).
=item I<pgsql_add_syslog>
Adds C<postgresql_syslog> to the I<syslog> data object (which is
supplied by the B<PSGConf::Control::syslog> module).
=item I<pgsql_add_kernel_params>
Under Solaris, adds entries to the I<system_vars> object (provided by
B<PSGConf::Control::Solaris>) to set C<shmsys:shminfo_shmmax> to
C<2097152> and C<shmsys:shminfo_shmmin> to C<1>.
=back
=back
=head1 SEE ALSO
L<perl>
postmaster(1)
L<PSGConf>
L<PSGConf::Control::Packages>
L<PSGConf::Control::Solaris>
L<PSGConf::Control::syslog>
L<PSGConf::Data::Boolean>
L<PSGConf::Data::List>
L<PSGConf::Util>
L<psgconf-intro>
=cut
syntax highlighted by Code2HTML, v. 0.9.1