SV: amvault $config_overrides

2010-11-16 Thread Gunnarsson, Gunnar
Hi,

I tested the patch and got some side effects in amreport see below. As you can 
see the date is incorrect.

Thanks Gunnar Gunnarsson

Tue Nov 16 12:24:29 2010: amreport: pid 22412 ruid 91 euid 91 version 3.2.0: 
start at Tue Nov 16 12:24:29 2010
Tue Nov 16 12:24:29 2010: amreport: config_overrides: mailto vault
Tue Nov 16 12:24:29 2010: amreport: pid 22412 ruid 91 euid 91 version 3.2.0: ren
ame at Tue Nov 16 12:24:29 2010
Tue Nov 16 12:24:29 2010: amreport: using logfile: /var/opt/amanda/orabck/log
Tue Nov 16 12:24:29 2010: amreport: operating in script mode
Tue Nov 16 12:24:29 2010: amreport: detected an amvault run
Tue Nov 16 12:24:29 2010: amreport: planned output: human mail vault
Tue Nov 16 12:24:29 2010: amreport: warning: Use of uninitialized value in 
numeric gt () at /opt/sfw/sbin/amreport line 368.
Tue Nov 16 12:24:29 2010: amreport: warning: Use of uninitialized value in int 
at /opt/sfw/sbin/amreport line 369.

Tue Nov 16 12:24:29 2010: amreport: invoking mail app: /usr/ucb/Mail -s SVK 
Unix AMVAULT MAIL REPORT FOR Dec 2,  vault
Tue Nov 16 12:24:33 2010: amreport: warning: Use of uninitialized value in 
numeric lt () at /usr/perl5/site_perl/5.8.4/Amanda/Report/human.pm line 1282.

Try the attached patch.

Jean-Louis

Gunnarsson, Gunnar wrote:
 Hi,
  
 I a minor issue regarding  $config_overrides that are not beeing 
 propagated to the call in amreport thus ignoring setting such as 
 tapettype mailto etc.
  
 debug(invoking amreport..);
 system($sbindir/amreport, $self-{'config_name'}, --from-amdump\ 
 );




amvault $config_overrides

2010-11-04 Thread Gunnarsson, Gunnar
Hi,

I a minor issue regarding  $config_overrides that are not beeing propagated to 
the call in amreport thus ignoring setting
such as tapettype mailto etc.

debug(invoking amreport..);
 system($sbindir/amreport, $self-{'config_name'}, --from-amdump\
);


Thanks Gunnar Gunnarsson



Re: amvault $config_overrides

2010-11-04 Thread Jean-Louis Martineau

Same problem with amdump.

Try the attached patch.

Jean-Louis

Gunnarsson, Gunnar wrote:

Hi,
 
I a minor issue regarding  $config_overrides that are not beeing 
propagated to the call in amreport thus ignoring setting

such as tapettype mailto etc.
 
debug(invoking amreport..);

system($sbindir/amreport, $self-{'config_name'}, --from-amdump\
);
 
 
Thanks Gunnar Gunnarsson
 


diff --git a/server-src/amdump.pl b/server-src/amdump.pl
index 69fe151..4caf718 100644
--- a/server-src/amdump.pl
+++ b/server-src/amdump.pl
@@ -151,7 +151,7 @@ INFO amdump amdump pid $$
 START driver date $timestamp
 ERROR amdump $msg
 EOF
-run_subprocess($sbindir/amreport, $config_name, '--from-amdump', '-l', $fakelogfile);
+run_subprocess($sbindir/amreport, $config_name, '--from-amdump', '-l', $fakelogfile, @config_overrides_opts);
 unlink($fakelogfile);
 
 # and we're done here
@@ -164,7 +164,7 @@ sub do_amcleanup {
 # logfiles are still around.  First, try an amcleanup -p to see if
 # the actual processes are already dead
 debug(runing amcleanup -p);
-run_subprocess($sbindir/amcleanup, '-p', $config_name);
+run_subprocess($sbindir/amcleanup, '-p', $config_name, @config_overrides_opts);
 
 # and check again
 return unless -f $amdump_log_filename || -f $trace_log_filename;
@@ -262,7 +262,7 @@ sub planner_driver_pipeline {
 
 sub do_amreport {
 debug(running amreport);
-run_subprocess($sbindir/amreport, $config_name, '--from-amdump');
+run_subprocess($sbindir/amreport, $config_name, '--from-amdump', @config_overrides_opts);
 }
 
 sub roll_trace_logs {
@@ -273,12 +273,12 @@ sub roll_trace_logs {
 
 sub trim_trace_logs {
 debug(trimming old trace logs);
-run_subprocess($amlibexecdir/amtrmlog, $config_name);
+run_subprocess($amlibexecdir/amtrmlog, $config_name, @config_overrides_opts);
 }
 
 sub trim_indexes {
 debug(trimming old indexes);
-run_subprocess($amlibexecdir/amtrmidx, $config_name);
+run_subprocess($amlibexecdir/amtrmidx, $config_name, @config_overrides_opts);
 }
 
 sub roll_amdump_logs {
diff --git a/server-src/amvault.pl b/server-src/amvault.pl
index 2646a4d..c89a6fa 100644
--- a/server-src/amvault.pl
+++ b/server-src/amvault.pl
@@ -140,6 +140,7 @@ sub new {
 
 	exporting = 0, # is an export in progress?
 	call_after_export = undef, # call this when export complete
+	config_overrides_opts = $params{'config_overrides_opts'},
 
 	# called when the operation is complete, with the exit
 	# status
@@ -625,8 +626,10 @@ sub quit {
 	log_add_full($L_FINISH, driver, fake driver finish);
 	log_add($L_INFO, pid-done $$);
 
-	debug(invoking amreport..);
-	system($sbindir/amreport, $self-{'config_name'}, --from-amdump);
+	my @amreport_cmd = ($sbindir/amreport, $self-{'config_name'}, --from-amdump,
+ @{$self-{'config_overrides_opts'}});
+	debug(invoking amreport ( . join( , @amreport_cmd) . ));
+	system(@amreport_cmd);
 
 	debug(rolling logfile..);
 	log_rename($self-{'dst_write_timestamp'});
@@ -894,6 +897,7 @@ EOF
 Amanda::Util::setup_application(amvault, server, $CONTEXT_CMDLINE);
 
 my $config_overrides = new_config_overrides($#ARGV+1);
+my @config_overrides_opts;
 my $opt_quiet = 0;
 my $opt_dry_run = 0;
 my $opt_fulls_only = 0;
@@ -932,7 +936,10 @@ sub add_autolabel {
 
 Getopt::Long::Configure(qw{ bundling });
 GetOptions(
-'o=s' = sub { add_config_override_opt($config_overrides, $_[1]); },
+'o=s' = sub {
+	push @config_overrides_opts, -o . $_[1];
+	add_config_override_opt($config_overrides, $_[1]);
+},
 'q|quiet' = \$opt_quiet,
 'n|dry-run' = \$opt_dry_run,
 'fulls-only' = \$opt_fulls_only,
@@ -986,7 +993,8 @@ my $vault = Amvault-new(
 opt_dry_run = $opt_dry_run,
 quiet = $opt_quiet,
 fulls_only = $opt_fulls_only,
-opt_export = $opt_export);
+opt_export = $opt_export,
+config_overrides_opts = \...@config_overrides_opts);
 Amanda::MainLoop::call_later(sub { $vault-run($exit_cb) });
 Amanda::MainLoop::run();