projects
/
freeside.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
remove obsolete mapsecrets stuff, RT#21563
[freeside.git]
/
FS
/
FS
/
part_export
/
shellcommands.pm
diff --git
a/FS/FS/part_export/shellcommands.pm
b/FS/FS/part_export/shellcommands.pm
index
b9d6551
..
9408d14
100644
(file)
--- a/
FS/FS/part_export/shellcommands.pm
+++ b/
FS/FS/part_export/shellcommands.pm
@@
-98,8
+98,7
@@
tie my %options, 'Tie::IxHash',
%info = (
'svc' => 'svc_acct',
%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,
'options' => \%options,
'nodomain' => 'Y',
'svc_machine' => 1,
@@
-244,12
+243,12
@@
sub _export_command {
${$_} = $svc_acct->getfield($_) foreach $svc_acct->fields;
# snarfs are unused at this point?
${$_} = $svc_acct->getfield($_) foreach $svc_acct->fields;
# snarfs are unused at this point?
- my $count = 1;
- foreach my $acct_snarf ( $svc_acct->acct_snarf ) {
- ${"snarf_$_$count"} = shell_quote( $acct_snarf->get($_) )
- foreach qw( machine username _password );
- $count++;
- }
+
#
my $count = 1;
+
#
foreach my $acct_snarf ( $svc_acct->acct_snarf ) {
+
#
${"snarf_$_$count"} = shell_quote( $acct_snarf->get($_) )
+
#
foreach qw( machine username _password );
+
#
$count++;
+
#
}
}
my $cust_pkg = $svc_acct->cust_svc->cust_pkg;
}
my $cust_pkg = $svc_acct->cust_svc->cust_pkg;
@@
-344,7
+343,7
@@
sub _export_command {
my @ssh_cmd_args = (
user => $self->option('user') || 'root',
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') || '',
command => $command_string,
stdin_string => $stdin_string,
ignored_errors => $self->option('ignored_errors') || '',
@@
-357,7
+356,7
@@
sub _export_command {
eval { ssh_cmd(@ssh_cmd_args) };
$error = $@;
$error = $error->full_message if ref $error; # Exception::Class::Base
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 {
if $error;
}
else {
@@
-417,7
+416,7
@@
sub _export_replace {
# $error ||= "can't change RADIUS groups";
#}
}
# $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 : '';
if $error;
$new_agent_custid = $new_cust_main ? $new_cust_main->agent_custid : '';
@@
-441,7
+440,7
@@
sub _export_replace {
my @ssh_cmd_args = (
user => $self->option('user') || 'root',
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') || '',
command => $command_string,
stdin_string => $stdin_string,
ignored_errors => $self->option('ignored_errors') || '',
@@
-454,7
+453,7
@@
sub _export_replace {
eval { ssh_cmd(@ssh_cmd_args) };
$error = $@;
$error = $error->full_message if ref $error; # Exception::Class::Base
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 {
if $error;
}
else {
@@
-491,7
+490,7
@@
sub ssh_cmd { #subroutine, not method
my ($output, $errput) = $ssh->capture2($ssh_opt, $opt->{'command'});
return if $opt->{'ignore_all_errors'};
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'})
if ( ($output || $errput)
&& $opt->{'ignored_errors'} && length($opt->{'ignored_errors'})
@@
-505,7
+504,9
@@
sub ssh_cmd { #subroutine, not method
$errput =~ s/[\s\n]//g;
}
$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'};
'';
}
die "$output\n" if $output and $opt->{'fail_on_output'};
'';
}