]> git.sur5r.net Git - bacula/bacula/blobdiff - gui/bweb/lib/Bconsole.pm
ebl display f and E state on error
[bacula/bacula] / gui / bweb / lib / Bconsole.pm
index fe6545196bdcfdc6347af0c57a59791e650eb7b9..d671ea631be1e976fb0e5422f8dc17c94beeb17d 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,
     };
 
@@ -99,9 +99,9 @@ sub log_stdout
     my ($self, $how) = @_;
 
     if ($self->{bconsole}) {
-       $self->{bconsole}->log_stdout($how);
+       $self->{bconsole}->log_stdout($how);
     }
-    
+
     $self->{log_stdout} = $how;
 }
 
@@ -189,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', qr/:/); # wait for drive input
-
-    $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) = @_;
@@ -222,15 +204,13 @@ sub label_barcodes
     $arg{drive} = $arg{drive} || '0' ;
     $arg{pool} = $arg{pool} || 'Scratch';
 
-    my $cmd = "label barcodes pool=\"$arg{pool}\" storage=\"$arg{storage}\"";
+    my $cmd = "label barcodes drive=$arg{drive} pool=\"$arg{pool}\" storage=\"$arg{storage}\"";
 
     if ($arg{slots}) {
        $cmd .= " slots=$arg{slots}";
     }
 
     $self->send("$cmd\n");
-    $self->expect_it('-re', ':'); # wait for drive input
-    $self->send("$arg{drive}\n");
     $self->expect_it('-re', '[?].+\)\s*:');
     my $res = $self->before();
     $self->send("yes\n");
@@ -284,8 +264,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
@@ -435,7 +416,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";