don't alter configuration on package updates#2338
Conversation
98f143c to
169a66f
Compare
6c0a0fb to
3a21ba9
Compare
arogge
left a comment
There was a problem hiding this comment.
That looks pretty weird, but good.
I have a few remarks, that should be addressed and I haven't yet tried it.
| BAREOS_DIRECTOR_USER=${BAREOS_DIRECTOR_USER-@dir_user@} | ||
| BAREOS_DIRECTOR_GROUP=${BAREOS_DIRECTOR_GROUP-@dir_group@} |
There was a problem hiding this comment.
Why not? After I changed some cmake settings, @dir_user@ etc. is set also for the systemtests directory. Therefore it has been required to set them to "". However, these scripts still set the configured @dir_user@ and only use "", if :- was changed to -
So there is a reason to make this change. Do you propose another approach?
There was a problem hiding this comment.
Agreed to keep it like this for now and change it in some other PR.
There was a problem hiding this comment.
I'm not sure to understand what was agreed to be kept, the proposed changes?
If we keep the actual code :-VAR I'm ok.
There was a problem hiding this comment.
No, we keep the change from this PR, so ${BAREOS_DIRECTOR_GROUP-@dir_group@}.
We need it, as BAREOS_DIRECTOR_GROUP (and others) can be set to "". With :- it would use the default value (@dir_group@), with : it will use "". The need the second behavior. However, once #2383 is implemented, this is no longer required.
core/platforms/freebsd/bareos-freebsd/bareos.com-common/pkg-plist.common
Outdated
Show resolved
Hide resolved
core/platforms/freebsd/bareos-freebsd/bareos.com-common/pkg-plist.storage-dplcompat
Outdated
Show resolved
Hide resolved
| lib/bareos/defaultconfigs/bareos-dir.d/storage/NULL.conf.example | ||
| lib/bareos/defaultconfigs/bareos-sd.d/device/NULL.conf.example |
There was a problem hiding this comment.
Use %%BAREOS_CONFIG_TEMPLATE_DIR%%
| lib/bareos/defaultconfigs/bareos-dir.d/storage/Tape.conf.example | ||
| lib/bareos/defaultconfigs/bareos-sd.d/autochanger/autochanger-0.conf.example | ||
| lib/bareos/defaultconfigs/bareos-sd.d/device/tapedrive-0.conf.example |
There was a problem hiding this comment.
Use %%BAREOS_CONFIG_TEMPLATE_DIR%%
| @@ -1,3 +1,3 @@ | |||
| /usr/local/lib/libbareossd-fifo.so | |||
There was a problem hiding this comment.
why do we have an absolute path here?
bc9401a to
85a51e2
Compare
55abd0c to
962664d
Compare
There was a problem hiding this comment.
Impressive work, I found a few possible improvements, like rpm variables.
On testing on Debian there's a few issue like warning that pop-up due to missing files
chmod: cannot access '/etc/bareos/bareos-dir-export//*/*.conf': No such file or directory
(there's a double / we should fix everywhere in bareos-config-libs
/usr/lib/bareos/scripts/bareos-config deploy_config --add-missing bareos-fd
'/usr/lib/bareos/defaultconfigs/bareos-fd.d//./director/bareos-dir.conf' -> '/etc/bareos/bareos-fd.d/./director/bareos-dir.conf'
'/usr/lib/bareos/defaultconfigs/bareos-fd.d//./messages/Standard.conf' -> '/etc/bareos/bareos-fd.d/./messages/Standard.conf'Info: replacing 'XXX_REPLACE_WITH_CLIENT_PASSWORD_XXX' in /etc/bareos/bareos-fd.d/director/bareos-dir.conf
To be documented:
- All use case like the removal of a component will not remove the whole configuration.
Re-Adding a component will not by default check if there's a missing or changed file, you will have to run the command manually
/usr/lib/bareos/scripts/bareos-config deploy_config --add-missing bareos-fd
see also internal/issue/467
|
|
||
| # check if variables are set via cmdline else set them to default values | ||
|
|
||
| include(GNUInstallDirs) |
There was a problem hiding this comment.
Are we sure that will also work on Windows, as we had an if contrib/CMakeLists.txt before ?
There was a problem hiding this comment.
In my tests, this seams to work well. Have you any specific doubt what could break? I've seen, these has be used differently at different places in the code. I tried to use it only once.
core/platforms/freebsd/bareos-freebsd/bareos.com-common/pkg-post-install
Outdated
Show resolved
Hide resolved
core/platforms/freebsd/bareos-freebsd/bareos.com-common/pkg-post-install
Show resolved
Hide resolved
| BAREOS_DIRECTOR_USER=${BAREOS_DIRECTOR_USER-@dir_user@} | ||
| BAREOS_DIRECTOR_GROUP=${BAREOS_DIRECTOR_GROUP-@dir_group@} |
There was a problem hiding this comment.
I'm not sure to understand what was agreed to be kept, the proposed changes?
If we keep the actual code :-VAR I'm ok.
| %define backend_dir %{_libdir}/%{name}/backends | ||
| %define plugin_dir %{_libdir}/%{name}/plugins | ||
| %define script_dir /usr/lib/%{name}/scripts | ||
| %define working_dir /var/lib/%{name} |
There was a problem hiding this comment.
| %define working_dir /var/lib/%{name} | |
| %define working_dir %{_sharedstatedir}/%{name} |
There was a problem hiding this comment.
While not using libdir is valid not using sharedstatedir doesn't rely on something valid from my point of view.
Of course we still can skip boyscout rule and let that in place for another decade ;-)
|
It would be the good time to fix also the don't set address with localhost under debian, so pg connection will be using socket instead tcp diff --git i/core/scripts/bareos-config-lib.sh.in w/core/scripts/bareos-config-lib.sh.in
index 2e34b4018..81fc0aba6 100644
--- i/core/scripts/bareos-config-lib.sh.in
+++ w/core/scripts/bareos-config-lib.sh.in
@@ -1137,7 +1137,10 @@ apply_dbconfig_settings()
[ "${dbc_install}" = "true" ] && [ "${dbc_upgrade}" = "true" ] || return 0
if [ -n "${dbc_dbserver}" ]; then
- set_config_param "bareos-dir" "Catalog" "MyCatalog" "dbaddress" "${dbc_dbserver}"
+ # Set the address only if not localhost, so local connection use socket
+ if [ "${dbc_dbserver}" != "localhost" ]; then
+ set_config_param "bareos-dir" "Catalog" "MyCatalog" "dbaddress" "${dbc_dbserver}"
+ fi
fi
if [ -n "${dbc_dbuser}" ]; then |
|
Last point on FreeBSD (maybe other) running an --add-missing on bareos-dir component show a missing line return |
bruno-at-bareos
left a comment
There was a problem hiding this comment.
While I would have enjoyed to see applying some variables changes like _rundir and _sharedstatedir
All the tests made have worked.
... instead of using RPM config files.
based on FreeBSD man page pkg-script the script order on upgrade is:
1. new pre-install
2. old pre-deinstall
3. replace binaries
4. new post-install
Based on this, we implemented saving the old configuration
(@sample files that are no longer defined) before they got deleted by
post-deinstall.
Spoiler:
this does not work, as on upgrade the old package gots complete removed,
including running post-deinstall, before any script of the new package
is called.
Config files in Bareos <= 24 are marked as @sample files. With Bareos 25 we use "bareos-config deploy_config --init" instead to initially populate the config directory. Unfortenatly, unmodified @sample files get removed during the upgrade process. FreeBSD first fully removes the old package and than install the new new. The order is (at least on FreeBSD 14): * pkg-pre-deinstall — from old package * Remove files from old package * pkg-post-deinstall — from old package * pkg-pre-install — from new package * Install files of the new package * pkg-post-install — from new package As workaround, when upgrading from Bareos < 24, the redeploy missing files from the new package. To keep track of this, a marker file is created: "${BAREOS_CONFIG_DIR}/.${COMPONENT}.deploy_config.version" deploy_config --add-missing is only called (in pkg-post-install) when either this file does not exist or the version number in there is < 25.
When communicating with a local PostgreSQL database server, it is advised to use a socket connection instead of TCP. When dbaddress is not set in the Bareos Catalog configuration, Bareos tries connects via sockets. If it is set, it connects via TCP. As dbconfig-common by default specifies "localhost" for a local PostgreSQL database, we ignore this setting.
436434d to
7d7f995
Compare
Thank you for contributing to the Bareos Project!
Currently, how Bareos is handling configuration files differs between platforms.
On most platform, the default configuration is stored in a configtemplatedirectory, like
/usr/lib/bareos/defaultconfigs/(Debian, macOS, Windows). Until now, RPM-based systems have the configuration directly stored at /etc/bareos.This PR also stores the default configuration in
/usr/lib/bareos/defaultconfigs/.Currently it uses deploy_config to initially deply the configuration, but this will change soon.
See bareos/internal#318
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)
Make sure you check/merge the PR using
devtools/pr-toolto have some simple automated checks run and a proper changelog record added.General
Required backport PRs have been createdSource code quality