projects
/
freeside.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
ef0678c
)
add debugging to cpanel export
author
ivan
<ivan>
Wed, 12 Oct 2005 08:57:54 +0000
(08:57 +0000)
committer
ivan
<ivan>
Wed, 12 Oct 2005 08:57:54 +0000
(08:57 +0000)
FS/FS/part_export/cpanel.pm
patch
|
blob
|
history
diff --git
a/FS/FS/part_export/cpanel.pm
b/FS/FS/part_export/cpanel.pm
index
7628ff6
..
9c1f60e
100644
(file)
--- a/
FS/FS/part_export/cpanel.pm
+++ b/
FS/FS/part_export/cpanel.pm
@@
-9,6
+9,7
@@
use FS::part_export;
tie my %options, 'Tie::IxHash',
'user' => { label=>'Remote access username' },
'accesshash' => { label=>'Remote access key', type=>'textarea' },
tie my %options, 'Tie::IxHash',
'user' => { label=>'Remote access username' },
'accesshash' => { label=>'Remote access key', type=>'textarea' },
+ 'debug' => { label=>'Enable debugging', type=>'checkbox' },
;
%info = (
;
%info = (
@@
-82,44
+83,68
@@
sub cpanel_queue {
$self->machine,
$self->option('user'),
$self->option('accesshash'),
$self->machine,
$self->option('user'),
$self->option('accesshash'),
+ $self->option('debug'),
@_
) or $queue;
}
sub cpanel_insert { #subroutine, not method
@_
) or $queue;
}
sub cpanel_insert { #subroutine, not method
- my $whm = cpanel_connect(shift, shift, shift);
+ my( $machine, $user, $accesshash, $debug ) = splice(@_,0,4);
+ my $whm = cpanel_connect($machine, $user, $accesshash, $debug);
+ warn " cpanel->createacct ". join(', ', @_). "\n"
+ if $debug;
my $response = $whm->createacct(@_);
die $whm->{'error'} if $whm->{'error'};
my $response = $whm->createacct(@_);
die $whm->{'error'} if $whm->{'error'};
+ warn " cpanel response: $response\n"
+ if $debug;
}
#sub cpanel_replace { #subroutine, not method
#}
sub cpanel_delete { #subroutine, not method
}
#sub cpanel_replace { #subroutine, not method
#}
sub cpanel_delete { #subroutine, not method
- my $whm = cpanel_connect(shift, shift, shift);
+ my( $machine, $user, $accesshash, $debug ) = splice(@_,0,4);
+ my $whm = cpanel_connect($machine, $user, $accesshash, $debug);
+ warn " cpanel->killacct ". join(', ', @_). "\n"
+ if $debug;
my $response = $whm->killacct(shift);
die $whm->{'error'} if $whm->{'error'};
my $response = $whm->killacct(shift);
die $whm->{'error'} if $whm->{'error'};
+ warn " cpanel response: $response\n"
+ if $debug;
}
sub cpanel_suspend { #subroutine, not method
}
sub cpanel_suspend { #subroutine, not method
- my $whm = cpanel_connect(shift, shift, shift);
+ my( $machine, $user, $accesshash, $debug ) = splice(@_,0,4);
+ my $whm = cpanel_connect($machine, $user, $accesshash, $debug);
+ warn " cpanel->suspend ". join(', ', @_). "\n"
+ if $debug;
my $response = $whm->suspend(shift);
die $whm->{'error'} if $whm->{'error'};
my $response = $whm->suspend(shift);
die $whm->{'error'} if $whm->{'error'};
+ warn " cpanel response: $response\n"
+ if $debug;
}
sub cpanel_unsuspend { #subroutine, not method
}
sub cpanel_unsuspend { #subroutine, not method
- my $whm = cpanel_connect(shift, shift, shift);
+ my( $machine, $user, $accesshash, $debug ) = splice(@_,0,4);
+ my $whm = cpanel_connect($machine, $user, $accesshash, $debug);
+ warn " cpanel->unsuspend ". join(', ', @_). "\n"
+ if $debug;
my $response = $whm->unsuspend(shift);
die $whm->{'error'} if $whm->{'error'};
my $response = $whm->unsuspend(shift);
die $whm->{'error'} if $whm->{'error'};
+ warn " cpanel response: $response\n"
+ if $debug;
}
sub cpanel_connect {
}
sub cpanel_connect {
- my( $host, $user, $accesshash ) = @_;
+ my( $host, $user, $accesshash
, $debug
) = @_;
eval "use Cpanel::Accounting;";
die $@ if $@;
eval "use Cpanel::Accounting;";
die $@ if $@;
+ warn "creating new Cpanel::Accounting connection to $user@$host\n"
+ if $debug;
+
my $whm = new Cpanel::Accounting;
$whm->{'host'} = $host;
$whm->{'user'} = $user;
my $whm = new Cpanel::Accounting;
$whm->{'host'} = $host;
$whm->{'user'} = $user;