]> git.sur5r.net Git - bacula/bacula/blobdiff - gui/bweb/lib/Bconsole.pm
ebl fix timeout
[bacula/bacula] / gui / bweb / lib / Bconsole.pm
index 4c61330c2eaf45874c94b3bc2759986b283cfd0d..deebdc805d6780c3b1036520c0029c79e085d37d 100644 (file)
@@ -42,7 +42,7 @@ sub new
        pref => $arg{pref},     # Pref object
        bconsole => undef,      # Expect object
        log_stdout => $arg{log_stdout} || 0,
-       timeout => $arg{debug} || 10,
+       timeout => $arg{timeout} || 20,
        debug   => $arg{debug} || 0,
     };
 
@@ -94,6 +94,17 @@ sub expect_it
     return 1;
 }
 
+sub log_stdout
+{
+    my ($self, $how) = @_;
+
+    if ($self->{bconsole}) {
+       $self->{bconsole}->log_stdout($how);
+    }
+
+    $self->{log_stdout} = $how;
+}
+
 sub connect
 {
     my ($self) = @_;
@@ -178,24 +189,6 @@ sub send_cmd_yes
     return $self->before();
 }
 
-sub send_cmd_with_drive
-{
-    my ($self, $cmd, $drive) = @_;
-    $drive = $drive || '0';
-
-    unless ($self->connect()) {
-       return '';
-    }
-    $self->send("$cmd\n");
-    $self->expect_it('-re', '\[0\]\s*:');
-
-    $self->send("$drive\n");
-    $self->expect_it('-re', '[0-9]');
-    $self->{bconsole}->clear_accum();
-    $self->expect_it('-re',qr/^[*]/);
-    return $self->before();
-}
-
 sub label_barcodes
 {
     my ($self, %arg) = @_;
@@ -273,8 +266,9 @@ sub director_get_sched
 sub update_slots
 {
     my ($self, $storage, $drive) = @_;
-    
-    return $self->send_cmd_with_drive("update slots storage=$storage", $drive);
+    $drive = $drive || 0;
+
+    return $self->send_cmd("update slots storage=$storage drive=$drive");
 }
 
 sub get_fileset
@@ -424,7 +418,7 @@ print "fileset : ", join(',', $c->list_fileset()), "\n";
 print "job : ",     join(',', $c->list_job()), "\n";
 print "storage : ", join(',', $c->list_storage()), "\n";
 #print "prune : " . $c->prune_volume('000001'), "\n";
-#print "update : " . $c->send_cmd_with_drive('update slots storage=SDLT-1-2'), "\n";
+#print "update : " . $c->send_cmd('update slots storage=SDLT-1-2, drive=0'), "\n";
 #print "label : ", join(',', $c->label_barcodes(storage => 'SDLT-1-2',
 #                                             slots => 6,
 #                                             drive => 0)), "\n";