Bacula-users

Re: [Bacula-users] possible console interface improvement (Was: Re: client list for restores sort order)

2008-11-13 03:24:47
Subject: Re: [Bacula-users] possible console interface improvement (Was: Re: client list for restores sort order)
From: Arno Lehmann <al AT its-lehmann DOT de>
To: bacula-users AT lists.sourceforge DOT net
Date: Thu, 13 Nov 2008 09:21:42 +0100
Hi,

13.11.2008 00:58, mark.bergman AT uphs.upenn DOT edu wrote:
> 
> In the message dated: Thu, 13 Nov 2008 00:03:18 +0100,
> The pithy ruminations from Arno Lehmann on 
> <Re: [Bacula-users] client list for restores sort order> were:
> => Hello,
> => 
> => 11.11.2008 18:15, Bob Hetzel wrote:
> => > I've currently got over 150 backup clients installed with bacula so when 
> => 
> => > I want to do a restore and I have it list the clients by name the list 
> => 
> => > is rather unwieldy.  I'm thinking the list is ordered by when they were 
> => 
> => > added?
> 
> I understand exactly what your describing.
> 
> One of my pet-peeves with Bacula is the inconsistent interface...some 
> commands 
> accept an item number from a list, some accept client or pool name (without 
> presenting a list), and lists aren't ordered.
> 
> => > 
> => 
> => > If it's doing a database query to generate this client list, where can 
> => 
> => > the sort order be changed?  Ideally I'd like to change it to order by 
> => 
> => > client name.
> => 
> => This seems to be done in cats/sql_get.c function get_client_ids(). I'm 
> => 
> => not sure if simply adding an "ORDER BY" statement works with all 
> => 
> => databases if you order by a field not actually requested.
> => 
> => Also, this could break existing scripts where you do something like
> => 
> => echo 'status client
> => 1
> => '
> 
> I use that kind of thing in scripts all the time. It's horrible, terrible, 
> ugly, and difficult to support over time.
> 
> Even worse is something like changing a volume from one pool to another...

There's one simple solution: Don't use those constructs... instead, 
use 'update volume=volname FromPool=oldpool pool=newpool'

(Untested, just had a look at the code... the manual does not mention 
this.)

> --------------------------------------------------
> bconsole -c /usr/local/bacula/etc/bconsole.conf << E-O-COMMANDS
> update vol
> 1
> 11
> $pool
> $mediaID
> Scratch
> update vol
> 1
> 1
> 4
> $mediaID
> 7
> 14
> --------------------------------------------------
> 
> In the first instance ($pool), the pool is specified by number, from a list. 
> In 
> the second instance (Scratch), it's given by name.
> 
> The other items (1, 11, 1, 1, 4, 7, 14) are all from lists. Horrible to debug 
> or document, and very easy to break.
> 
> Tell me, quickly, what's does the 3rd instance of "1" mean there?

I don't have to as I don't want to use this construction :-)

> I'd really like to see bacula support both the current style (as to not break 
> too many scripts) and also support specifying items verbosely, so that the 
> previous example would be written as:

Well, the keyword=value syntax exitst.

> -------------------------------------------------------------------------
> bconsole -c /usr/local/bacula/etc/bconsole.conf << E-O-COMMANDS
> update vol
> Volume parameters
> Pool
> Incremental
> $mediaID
> Scratch
> update vol
> Volume parameters
> Volume Status
> Scratch
> $mediaID
> Append
> Done
> -------------------------------------------------------------------------
> 
> 
> It's not beautiful, but it's much easier to read, write, and debug, and it's 
> resistent to future interface changes.

So is the existing option.

> Obviously, the same change would apply to the "query" command, which is even 
> more likely to change as users write their own queries.

Yes. They query command can only be used interactively, and it is my 
impression that is is most useful in manual interaction anyway... to 
automate catalog queries, I prefer to ask the DB directly, through a 
shell schrip, perl, php, or whatever.

> => 
> => so I would carefully consider such a change.
> => 
> => Arno
> => 
> => >     Bob
> 
> Mark

Arno

-- 
Arno Lehmann
IT-Service Lehmann
Sandstr. 6, 49080 Osnabrück
www.its-lehmann.de

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Bacula-users mailing list
Bacula-users AT lists.sourceforge DOT net
https://lists.sourceforge.net/lists/listinfo/bacula-users