Front page

Improving error message when restoring on a different client

3802012a45ca4b7fb7d1aa3f3cda1775
CLASSIC AFTERMATH ABSURD

From: Paul Waring <paul@xk7.net>
Date: Wed, 28 Dec 2016 20:35:45 +0000

   I recently tried restoring backups of client A on another machine B 
   using the following command from the obnam documentation.
   
   obnam mount -r /path/to/repository --to ~/restore/
   
   The error message I received was:
   
   ERROR: R24424X: Repository client B does not exist
   
   I had no idea what R24424X was or why obnam would be telling me that 
   client B didn't exist when I wanted to restore client A (I keep one 
   client per repository, which may not be a typical use case).
   
   I eventually worked out that I had to use '--client-name A' as an extra 
   argument to 'obnam mount'. I was wondering if this error message could 
   be improved by hinting to the user as to which command line option they 
   need, e.g.
   
   ERROR: R24424X: Repository client B does not exist. If you are restoring 
   to a different client, try: --client-name [client]
   
   Alternatively, perhaps it might be worth documenting the use of 
   --client-name in the 'Restoring from backups' section of the manual? I 
   am happy to improve the docs, but I have no idea where to start with the 
   code.
   
   Thanks
   
   Paul
From: Lars Wirzenius <liw@liw.fi>
Date: Thu, 29 Dec 2016 11:23:22 +0200

   On Wed, Dec 28, 2016 at 08:35:45PM +0000, Paul Waring wrote:
   > I recently tried restoring backups of client A on another machine B using
   > the following command from the obnam documentation.
   > 
   > obnam mount -r /path/to/repository --to ~/restore/
   > 
   > The error message I received was:
   > 
   > ERROR: R24424X: Repository client B does not exist
   > 
   > I had no idea what R24424X was or why obnam would be telling me that client
   > B didn't exist when I wanted to restore client A (I keep one client per
   > repository, which may not be a typical use case).
   
   The R.....X codes are Obnam's error codes. They're reasonably stable
   and automatically generated. It's there to make it easier to grep for
   errors. Some day it'll be useful to understand log files from users
   who use a non-English locale, as the error code will be unchanged.
   
   See obnamlib/structurederror.py for details. In short, each error
   message is a class (subclass of obnamlib.StructuredError) and the
   class contains the error text (or template).
   
   The manual has an automatically generated list of error codes and
   message:
   http://code.liw.fi/obnam/manual/ci/obnam-manual.en.html#appendix-error-messages
   
   This particular error message is "generic", i.e., used for all obnam
   commands that need to access the repository as a client, but the
   client name isn't found (possibly becuase, as in your case, the
   client name is automatically chosen from the computer hostname, and
   the user didn't know about it). Thus, I'd like the error message text
   to be suitable for them. Possibly something like:
   
       "Client B does not exist in the repository. Use --client-name A to
       choose client name, and 'obnam clients' to see which exist."
   
   Improving the manual would be a good thing as well.
   
   > Alternatively, perhaps it might be worth documenting the use of
   > --client-name in the 'Restoring from backups' section of the manual? I am
   > happy to improve the docs, but I have no idea where to start with the code.
   
   Patch for error messsage or manual or both warmly welcome. Thank you.