%info = (
'svc' => 'svc_acct',
- 'desc' =>
- 'Real-time export via remote SSH (i.e. useradd, userdel, etc.)',
+ 'desc' => 'Real-time export via remote SSH (i.e. useradd, userdel, etc.)',
'options' => \%options,
'nodomain' => 'Y',
'svc_machine' => 1,
my @ssh_cmd_args = (
user => $self->option('user') || 'root',
- host => $self->machine,
+ host => $self->svc_machine($svc_acct),
command => $command_string,
stdin_string => $stdin_string,
ignored_errors => $self->option('ignored_errors') || '',
eval { ssh_cmd(@ssh_cmd_args) };
$error = $@;
$error = $error->full_message if ref $error; # Exception::Class::Base
- return $error. ' ('. $self->exporttype. ' to '. $self->machine. ')'
+ return $error. ' ('. $self->exporttype. ' to '. $self->svc_machine($svc_acct). ')'
if $error;
}
else {
# $error ||= "can't change RADIUS groups";
#}
}
- return $error. ' ('. $self->exporttype. ' to '. $self->machine. ')'
+ return $error. ' ('. $self->exporttype. ' to '. $self->svc_machine($new). ')'
if $error;
$new_agent_custid = $new_cust_main ? $new_cust_main->agent_custid : '';
my @ssh_cmd_args = (
user => $self->option('user') || 'root',
- host => $self->machine,
+ host => $self->svc_machine($new),
command => $command_string,
stdin_string => $stdin_string,
ignored_errors => $self->option('ignored_errors') || '',
eval { ssh_cmd(@ssh_cmd_args) };
$error = $@;
$error = $error->full_message if ref $error; # Exception::Class::Base
- return $error. ' ('. $self->exporttype. ' to '. $self->machine. ')'
+ return $error. ' ('. $self->exporttype. ' to '. $self->svc_machine($new). ')'
if $error;
}
else {
my ($output, $errput) = $ssh->capture2($ssh_opt, $opt->{'command'});
return if $opt->{'ignore_all_errors'};
- die "Error running SSH command: ". $ssh->error if $ssh->error;
+ #die "Error running SSH command: ". $ssh->error if $ssh->error;
if ( ($output || $errput)
&& $opt->{'ignored_errors'} && length($opt->{'ignored_errors'})
$errput =~ s/[\s\n]//g;
}
- die "$errput\n" if $errput;
+ die (($errput || $ssh->error). "\n") if $errput || $ssh->error;
+ #die "$errput\n" if $errput;
+
die "$output\n" if $output and $opt->{'fail_on_output'};
'';
}