#914 Issue closed: rear exits successufly when unknown backup method is specified

Labels: enhancement, cleanup, fixed / solved / done

zelial opened issue at 2016-07-14 10:44:

Relax-and-Recover (rear) Issue Template

Please fill in the following items before submitting a new issue:

  • rear version (/usr/sbin/rear -V):
    1.17.2 / Git

  • OS version (cat /etc/rear/os.conf or lsb_release -a):
    RedHatEnterpriseServer 7

  • rear configuration files (cat /etc/rear/site.conf or cat /etc/rear/local.conf):
    OUTPUT=USB

    OUTPUT_URL="rsync://192.168.122.153/home/rear"

    USB_DEVICE=/dev/sda1
    GRUB_RESCUE=1
    GRUB_PASSWORD=rootroot
    BACKUP_URL=usr:///dev/sda1
    BACKUP=HAHAHAHA

  • Brief description of the issue
    rear mkbackuponly appears to work even though it doesn't create the backup (doesn't print any error and exits with exit code 0). In verbose mode It does prints a warning message, but it suggest it might still work:

The BACKUP method "HAHAHAHA" is not known to rear. Use on your own risk

  • Work-around, if any

jsmeix commented at 2016-07-14 11:31:

Technically it would be easy to let
usr/share/rear/backup/default/00_valid_backup_methods.sh
error out if a BACKUP method is not known to rear
by replacing

    LogPrint "The BACKUP method ...

with

    Error "The BACKUP method ...

@schlomo @gdha
I wonder if it is a good idea to error out
when a BACKUP method is not found
in usr/share/rear/conf/default.conf

In general I think rear should error out if mandatory
conditions to propceed are not fulfilled cf.
https://github.com/rear/rear/wiki/Coding-Style

In this particular case I think it is a good idea
to error out when a BACKUP method is not found
in usr/share/rear/conf/default.conf regardless
that this is strictly speaking not a mandatory
condition to propceed because the BACKUP method
could be implemented nevertheless.

On the other hand I think all implemented BACKUP methods
should be mentioned in usr/share/rear/conf/default.conf

If someone implements a new BACKUP method
he would immediately notice via that error out
that he must also mention it in default.conf
which ensures a minimum documentation about
what BACKUP methods are implemented in rear.

I did a pull request: https://github.com/rear/rear/pull/916

@zelial

Background information:

In general you have zillions of possibilities
to make improper settings in /etc/rear/local.conf.

In practice it is impossible to check all conditions
to ensure that "rear mkbackup" only succeeds
when actually everything is right.

In general you must carefully verify that your
particular disaster recovery procedure that you set up
in your environment actually works for your systems.

jsmeix commented at 2016-07-14 11:57:

See the initial issue https://github.com/rear/rear/issues/159

FYI:
"git blame usr/share/rear/backup/default/00_valid_backup_methods.sh"
shows 00_valid_backup_methods.sh was created by
commit fc9722d5ee394b90cf969ee54068d715dfaa5991
and "git log" shows that it was because of https://github.com/rear/rear/issues/159

gdha commented at 2016-07-14 18:44:

@jsmeix OK lets bail out when BACKUP method is not known - however, this means we should start with a developers guide, no?

jsmeix commented at 2016-07-15 08:09:

Yes!
I fully agree to have a Relax-and-Recover developers guide.

I initiated
https://github.com/rear/rear/wiki/Developers-Guide

If you have time, just add what you like to have there
but of course: first things first i.e. enjoy your leisure time!


[Export of Github issue for rear/rear.]