move export info to the modules themselves
[freeside.git] / FS / FS / part_export / domain_shellcommands.pm
index d2f55e5..d295eec 100644 (file)
@@ -23,21 +23,21 @@ sub _export_command {
   my $command = $self->option($action);
 
   #set variable for the command
+  no strict 'vars';
   {
     no strict 'refs';
     ${$_} = $svc_domain->getfield($_) foreach $svc_domain->fields;
   }
+  ( $qdomain = $domain ) =~ s/\./:/g; #see dot-qmail(5): EXTENSION ADDRESSES
 
-#  my $domain_record = $svc_www->domain_record; # or die ?
-#  my $zone = $domain_record->reczone; # or die ?
-#  unless ( $zone =~ /\.$/ ) {
-#    my $svc_domain = $domain_record->svc_domain; # or die ?
-#    $zone .= '.'. $svc_domain->domain;
-#  }
-
-#  my $svc_acct = $svc_www->svc_acct; # or die ?
-#  my $username = $svc_acct->username;
-#  my $homedir = $svc_acct->dir; # or die ?
+  if ( $svc_domain->catchall ) {
+    no strict 'refs';
+    my $svc_acct = $svc_domain->catchall_svc_acct;
+    ${$_} = $svc_acct->getfield($_) foreach qw(uid gid dir);
+  } else {
+    no strict 'refs';
+    ${$_} = '' foreach qw(uid gid dir);
+  }
 
   #done setting variables for the command
 
@@ -53,32 +53,29 @@ sub _export_replace {
   my $command = $self->option('usermod');
   
   #set variable for the command
+  no strict 'vars';
   {
     no strict 'refs';
     ${"old_$_"} = $old->getfield($_) foreach $old->fields;
     ${"new_$_"} = $new->getfield($_) foreach $new->fields;
   }
-#  my $old_domain_record = $old->domain_record; # or die ?
-#  my $old_zone = $old_domain_record->reczone; # or die ?
-#  unless ( $old_zone =~ /\.$/ ) {
-#    my $old_svc_domain = $old_domain_record->svc_domain; # or die ?
-#    $old_zone .= '.'. $old_svc_domain->domain;
-#  }
-#
-#  my $old_svc_acct = $old->svc_acct; # or die ?
-#  my $old_username = $old_svc_acct->username;
-#  my $old_homedir = $old_svc_acct->dir; # or die ?
-#
-#  my $new_domain_record = $new->domain_record; # or die ?
-#  my $new_zone = $new_domain_record->reczone; # or die ?
-#  unless ( $new_zone =~ /\.$/ ) {
-#    my $new_svc_domain = $new_domain_record->svc_domain; # or die ?
-#    $new_zone .= '.'. $new_svc_domain->domain;
-#  }
-
-#  my $new_svc_acct = $new->svc_acct; # or die ?
-#  my $new_username = $new_svc_acct->username;
-#  my $new_homedir = $new_svc_acct->dir; # or die ?
+  ( $old_qdomain = $old_domain ) =~ s/\./:/g; #see dot-qmail(5): EXTENSION ADDRESSES
+  ( $new_qdomain = $new_domain ) =~ s/\./:/g; #see dot-qmail(5): EXTENSION ADDRESSES
+
+  if ( $old->catchall ) {
+    no strict 'refs';
+    my $svc_acct = $old->catchall_svc_acct;
+    ${"old_$_"} = $svc_acct->getfield($_) foreach qw(uid gid dir);
+  } else {
+    ${"old_$_"} = '' foreach qw(uid gid dir);
+  }
+  if ( $new->catchall ) {
+    no strict 'refs';
+    my $svc_acct = $new->catchall_svc_acct;
+    ${"new_$_"} = $svc_acct->getfield($_) foreach qw(uid gid dir);
+  } else {
+    ${"new_$_"} = '' foreach qw(uid gid dir);
+  }
 
   #done setting variables for the command
 
@@ -100,7 +97,7 @@ sub shellcommands_queue {
 }
 
 sub ssh_cmd { #subroutine, not method
-  use Net::SSH '0.06';
+  use Net::SSH '0.08';
   &Net::SSH::ssh_cmd( { @_ } );
 }