X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Fpart_export%2Fcardfortress.pm;h=ae8e2966f44dcfd8ff783d5b4f04374217c5c8bd;hb=38e34bbc53a4222c7507e95914e1364a5a74623f;hp=e79205eacea258e2f19f19a44619d9f9632e7f34;hpb=de39a5275fcc744487634a9a0b37cae1889c9fc3;p=freeside.git diff --git a/FS/FS/part_export/cardfortress.pm b/FS/FS/part_export/cardfortress.pm index e79205eac..ae8e2966f 100644 --- a/FS/FS/part_export/cardfortress.pm +++ b/FS/FS/part_export/cardfortress.pm @@ -4,6 +4,7 @@ use strict; use base 'FS::part_export'; use vars qw( %info ); use String::ShellQuote; +use Net::OpenSSH; #tie my %options, 'Tie::IxHash'; #; @@ -21,13 +22,12 @@ sub rebless { shift; } sub _export_insert { my($self, $svc_acct) = (shift, shift); - eval "use Net::OpenSSH;"; - return $@ if $@; open my $def_in, '<', '/dev/null' or die "unable to open /dev/null"; my $ssh = Net::OpenSSH->new( $self->machine, default_stdin_fh => $def_in ); + #capture2 and return STDERR, its probably useful if there's a problem my $private_key = $ssh->capture( { 'stdin_data' => $svc_acct->_password. "\n" }, '/usr/local/bin/merchant_create', map $svc_acct->$_, qw( username finger ) @@ -55,19 +55,22 @@ sub _export_replace { ''; } -sub _export_delete { - my( $self, $svc_acct ) = (shift, shift); +#well, we're just going to disable them for now, but there you go +sub _export_delete { shift->merchant_disable(@_) } + +sub _export_suspend { shift->merchant_disable(@_) } - #well, we're just going to disable them for now, but there you go +sub _export_unsuspend { shift->merchant_enable(@_) } - eval "use Net::OpenSSH;"; - return $@ if $@; +sub merchant_disable { + my( $self, $svc_acct ) = (shift, shift); open my $def_in, '<', '/dev/null' or die "unable to open /dev/null"; my $ssh = Net::OpenSSH->new( $self->machine, default_stdin_fh => $def_in ); - my $private_key = $ssh->run( + #capture2 and return STDERR, its probably useful if there's a problem + my $unused_output = $ssh->capture( '/usr/local/bin/merchant_disable', map $svc_acct->$_, qw( username ) ); return $ssh->error if $ssh->error; @@ -76,4 +79,21 @@ sub _export_delete { } +sub merchant_enable { + my( $self, $svc_acct ) = (shift, shift); + + open my $def_in, '<', '/dev/null' or die "unable to open /dev/null"; + my $ssh = Net::OpenSSH->new( $self->machine, + default_stdin_fh => $def_in ); + + #capture2 and return STDERR, its probably useful if there's a problem + my $unused_output = $ssh->capture( + '/usr/local/bin/merchant_enable', map $svc_acct->$_, qw( username ) + ); + return $ssh->error if $ssh->error; + + ''; + +} + 1;