core/scripts: sanitize and clean up scripts, improve bareos-config-lib.sh, remove make_catalog_backup.pl, use make_catalog_backup#1081
Conversation
joergsteffens
left a comment
There was a problem hiding this comment.
This change can/will break existing installations, as the existing BackupCatalog.conf might not get replaced during an update (at least on Debian). Therefore it would prefer if make_catalog_backup.pl got replaced by a symlink to make_catalog_backup or a wrapper script to it additionally issuing a warning.
If the file is not replaced by the packaging that mean the user has changed it, so it out of our responsibility and we can't do much about that. Maybe you don't see, this PR in changelog will be in breaking changes for 22 (and can be also mentioned in the release note). I don't believe trying to hide the change by another layer is the right thing to do. |
As I tried to say, on Debian the file will not be replaced, even if it is unchanged by the user. I don't think it is good practice that all Debian installation will fail to start after an update. Creating a wrapper script with a warning might be a good compromise. |
Debian packaging policy state it will handle it reference here If Bareos Debian packages are not doing it according then they have to be fixed. |
6af5df1 to
e27b669
Compare
d2052c1 to
9867483
Compare
6a534f6 to
aaf5bc3
Compare
|
Everything works correctly last build failed F35 when it was not before, a rerun will certainly fix it. |
joergsteffens
left a comment
There was a problem hiding this comment.
The file docs/manuals/source/TasksAndConcepts/CatalogMaintenance.rst contains references to the old perl script:
:file:`make_catalog_backup.pl` backup backup the Bareos database, default on Linux
:file:`make_catalog_backup` backup backup the Bareos database for systems without Perl
Best remove them.
|
@joergsteffens notice
|
07eca25 to
b052150
Compare
1a0f47d to
7a5782d
Compare
|
The script has its signature changed as it doesn't support anymore additional parameters like the initial .pl was |
|
It is a long time ago that I had to program in Perl, but I think, in this context |
cdba137 to
1943a6a
Compare
| # This sends the bootstrap via mail for disaster recovery. | ||
| # Should be sent to another system, please change recipient accordingly | ||
| Write Bootstrap = "|/tmp/bin/bsmtp -h smtp_host -f \"\(Bareos\) \" -s \"Bootstrap for Job %j\" root@localhost" # (#01) | ||
| Write Bootstrap = "|@bindir@/bsmtp -h @smtp_host@ -f \"\(Bareos\) \" -s \"Bootstrap for Job %j\" @job_email@" |
There was a problem hiding this comment.
I probably doesn't matter, but this is not an *.in file, so no replacement of @ variables.
f609ae8 to
2b0caa8
Compare
ec277a4 to
f3c69eb
Compare
joergsteffens
left a comment
There was a problem hiding this comment.
I'm not finished with the review, however here are my first remarks.
bad4882 to
f3862d5
Compare
|
@joergsteffens the final review should be ok now with commit squashed, and last changelog. |
9fb9eaf to
35cb123
Compare
- core/scripts: sanitize and cleanup code, improve bareos-config-lib.sh.
- systemtests/tests: remove unused job/BackupCatalog.conf.in files.
- packaging: debian review and improve database-common dbconfig scripts.
- breaking changes: make_bareos_catalog script signature has changed
+ usage is now make_catalog_backup <catalog-name>
+ if more than one args is passed a warning is emit.
+ removed multi database driver to use only PostreSQL.
+ removed bareos-dbcheck dependency.
+ use of bareos-config-lib get_database_ functions
to setup the command line with PG env vars.
script can then be run without a .pgpass.
- create systemtests/tests/bareos/testrunner-test-make-catalog-backup
to test the default BackupCatalog job.
+ backup the catalog.
+ store versionid.
+ restore the backup.
+ drop all tables.
+ restore the catalog with the restored dump script.
+ check number of tables and versionid.
+ restart Bareos ... and compare output.
by this, we make sure, that Bareos is able to start again
and also leave this test in the same state as the other tests
(running Bareos daemons).
- bareos-config-lib.sh remove obsolete or non used functions.
+ get_database_driver
+ initialize_database_driver
+ get_database_utility_path
+ get_databases_installed
+ fix unbounded vars in bareos-config-lib.sh.
- remove support of multiple database items.
- add new function handle_database_scripts_command_line_parameter
- add Bareos License to bareos-config.
- remove usage of external parameters (like psql calls ($*)).
- add check to failed if $1 is not postgresql, warn user about deprecated usage.
- suppress dbcheck dependency.
- get_database_param is using new bareos-dir -xcRessourceName functionality
- use shellcheck -s sh to sanitize code.
- make delete_catalog_backup work the same as make_catalog_backup (using CatalogName)
- make apply_dbconfig supporting remote dbaddress
- update sed expression to only use * for POSIX compliance
- databases scripts (create,drop,make,delete,grant,update):
+ standardized messages.
+ fix handle_database_scripts_command_line_parameter call.
+ enforce -u and -e.
- make_catalog_backup.pl is now a wrapper sh script which warn
about its deprecated usage (see breaking above)
- docs: CatalogMaintenance.rst chapter renew:
+ use actual BackupCatalog.conf in example.
+ replace mysql related content with PostgreSQL equivalent.
+ remove make_catalog_backup.pl reference.
+ refresh remote database section with new instructions.
Signed-off-by: Bruno Friedmann <bruno.friedmann@bareos.com>
Co-authored-by: Jörg Steffens <joergsteffens@users.noreply.github.com>
0fc6c65 to
a5fa265
Compare
This PR is about cleaning the scripts used in
core/scripts and core/src/catsand replacing the old perlmake_catalog_backup.plby the posix sh scriptmake_catalog_backup.Breaking changes are the following
make_catalog_backupscript signature changed, and it uses the get_database_ functions frombareos-config-lib.shmake_catalog_backup.plstring was used in the default configuration example injob/BackupCatalog.conf(if the package manager doesn't handle or the user changed the default, the line has to be manually changed according to the new documentation).A new systemtests has been created and enabled to run the default BackupCatalog job.
The unused
systemtests/tests/*/etc/bareos/bareos-dir.d/job/BackupCatalog.conf.infile has been removed except for bareos test.The perl dependency has been removed on all platform builds.
For convenience a compatible wrapper script
make_backup_catalog.plis delivered until Bareos version 23. This script emit a warning about the deprecated status in job log when used.Please check
If you have any questions or problems, please give a comment in the PR.
Helpful documentation and best practices
Checklist for the reviewer of the PR (will be processed by the Bareos team)
General
[ ] If backport: add original PR number and target branch at top of this file: Backport of PR#000 to bareos-2xSource code quality
bareos-check-sources --since-mergedoes not report any problemsgit statusshould not report modifications in the source tree after building and testingTests