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 => {
'Readonly' => 0,
'Digest::SHA1' => 0,
'Config::YAML' => 0,
},
script_files => [
'scripts/da',

View File

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