Make no_queue option work correctly
authormark <mark>
Thu, 30 Jul 2009 07:35:18 +0000 (07:35 +0000)
committermark <mark>
Thu, 30 Jul 2009 07:35:18 +0000 (07:35 +0000)
FS/FS/part_export/shellcommands.pm

index e375302..11e3b7d 100644 (file)
@@ -301,13 +301,23 @@ sub _export_command {
   $ldap_password  = shell_quote $ldap_password;
 
   my $command_string = eval(qq("$command"));
-
-  $self->shellcommands_queue( $svc_acct->svcnum,
-    user         => $self->option('user')||'root',
-    host         => $self->machine,
-    command      => $command_string,
-    stdin_string => $stdin_string,
+  my @ssh_cmd_args = (
+    user          => $self->option('user') || 'root',
+    host          => $self->machine,
+    command       => $command_string,
+    stdin_string  => $stdin_string,
   );
+
+  if($self->options('no_queue')) {
+    # discard return value just like freeside-queued.
+    eval { ssh_cmd(@ssh_cmd_args) };
+    $error = $@;
+    return $error. ' ('. $self->exporttype. ' to '. $self->machine. ')'
+      if $error;
+  }
+  else {
+    $self->shellcommands_queue( $new->svcnum, @ssh_cmd_args );
+  }
 }
 
 sub _export_replace {