Re: "-otaperscan=XXX" override prevents reading of CONFIG/amanda.conf
Nathan Stratton Treadway <[email protected]> Fri, 10 Nov 2017 14:35:36 -0500
| Newsgroups | gmane.comp.archivers.amanda.devel |
|---|---|
| Message-ID | <[email protected]> |
On Fri, Nov 10, 2017 at 08:14:31 -0500, Jean-Louis Martineau wrote:
> I just finished the patch, can you try it?
Great, I will give the patch a try soon.
If I understand the patch correctly, the cause of the problem was that
config_init_with_global() was calling
config_init(CONFIG_INIT_GLOBAL...), then which generated an error when
the overrides were applied, since the "define taperscan" sections hadn't
been parsed yet.
If so, I was wondering why the overrides need to be applied twice?
Would it make any sense to instead restructure config_init_with_global()
and config_init() so that the program flow is more like this:
init_defaults()
attempt read_conffile(/etc/amanda/amanda.conf)
read_conffile(/etc/amanda/CONFIG/amanda.conf)
apply_config_overrides()
Or, in other words, since the last occurance processed of each parameter takes
precedence, is there any reason to apply the overrides between parsing
the global amanda.conf and the CONFIG/amanda.conf?
Nathan
p.s. On a related note, I found that although the error messages are
similar when I use an invalid storage name, and the parsing of the two
looks very similar in conffile.c, I am able to successfully override the
storage= with -o, and it continues to load TestBackup/amanda.conf even
with that override in place:
=====
# amgetconf TestBackup storage -ostorage=bad
parse error: storage 'bad' is not defined
parse error: storage 'bad' is not defined
amgetconf: errors processing config file at /usr/sbin/amgetconf line 363.
# strace amgetconf TestBackup storage -ostorage=bad 2>&1 | grep amanda.conf
open("/etc/amanda/amanda.conf", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/etc/amanda/TestBackup/amanda.conf", O_RDONLY) = 3
read(3, "# amanda.conf - sample Amanda co"..., 4096) = 4096
# amgetconf TestBackup storage -ostorage=TestOffsite
TestOffsite
# strace amgetconf TestBackup storage -ostorage=TestOffsite 2>&1 | grep amanda.conf
open("/etc/amanda/amanda.conf", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/etc/amanda/TestBackup/amanda.conf", O_RDONLY) = 3
read(3, "# amanda.conf - sample Amanda co"..., 4096) = 4096
=====
Do you know off-hand why -ostorage= and -otaperscan= have different behavior
in this regard?
Thanks.
----------------------------------------------------------------------------
Nathan Stratton Treadway - [email protected] - Mid-Atlantic region
Ray Ontko & Co. - Software consulting services - http://www.ontko.com/
GPG Key: http://www.ontko.com/~nathanst/gpg_key.txt ID: 1023D/ECFB6239
Key fingerprint = 6AD8 485E 20B9 5C71 231C 0C32 15F3 ADCD ECFB 6239