Moved prune list of disk agent to a config file.

This commit is contained in:
hjp 2007-11-17 21:01:51 +00:00
parent 1546672d9a
commit 474ef9e7ef
2 changed files with 18 additions and 9 deletions

View File

@ -10,6 +10,7 @@ my $build = Simba::Build->new
requires => { requires => {
'Readonly' => 0, 'Readonly' => 0,
'Digest::SHA1' => 0, 'Digest::SHA1' => 0,
'Config::YAML' => 0,
}, },
script_files => [ script_files => [
'scripts/da', 'scripts/da',

View File

@ -11,6 +11,7 @@ use List::Util qw(min);
use IO::Handle; use IO::Handle;
use Simba::Util qw(quote unquote typestr); use Simba::Util qw(quote unquote typestr);
use POSIX qw(strftime); use POSIX qw(strftime);
use Config::YAML;
Readonly my $BUFSIZE => 128 * 1024; Readonly my $BUFSIZE => 128 * 1024;
#my $BUFSIZE = 128 * 1024; #my $BUFSIZE = 128 * 1024;
@ -35,7 +36,13 @@ sub new {
# * Other system dependent parameters, e.g., whether to use ACLs # * Other system dependent parameters, e.g., whether to use ACLs
# #
# For now we just hardcode the stuff: # For now we just hardcode the stuff:
my $config = Config::YAML->new( config => '/etc/simba/ca.conf');
if ($config->{prune}) {
for (@{ $config->{prune} }) {
$_ = ".$_" if (m{^/});
$self->{prune}{$_} = 1;
}
} else {
$self->{prune} = { $self->{prune} = {
# directories to prune. These are relative # directories to prune. These are relative
# paths which may not be ideal. # paths which may not be ideal.
@ -44,6 +51,7 @@ sub new {
'./nfs' => 1, './nfs' => 1,
'./backup' => 1, './backup' => 1,
}; };
}
$self->{charset} = 'utf-8'; $self->{charset} = 'utf-8';
$self->{fh_out} = exists($opt->{fh_out}) ? $opt->{fh_out} : \*STDOUT; $self->{fh_out} = exists($opt->{fh_out}) ? $opt->{fh_out} : \*STDOUT;
$self->{fh_log} = exists($opt->{fh_log}) ? $opt->{fh_log} : \*STDERR; $self->{fh_log} = exists($opt->{fh_log}) ? $opt->{fh_log} : \*STDERR;