Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve python plugin configuration #1619

Merged

Conversation

arogge
Copy link
Member

@arogge arogge commented Dec 11, 2023

Backport of PR #1605 to bareos-23

Backported using git cherry-pick -x 399b037a5~..5a8643760 with no manual intervention needed.

Please check

  • Short description and the purpose of this PR is present above this paragraph
  • Your name is present in the AUTHORS file (optional)

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-tool to have some simple automated checks run and a proper changelog record added.

General
  • Is the PR title usable as CHANGELOG entry?
  • Purpose of the PR is understood
  • Commit descriptions are understandable and well formatted
  • Check backport line
    Required backport PRs have been created
Source code quality
  • Source code changes are understandable
  • Variable and function names are meaningful
  • Code comments are correct (logically and spelling)
  • Required documentation changes are present and part of the PR
Tests
  • Decision taken that a test is required (if not, then remove this paragraph)
  • The choice of the type of test (unit test or systemtest) is reasonable
  • Testname matches exactly what is being tested
  • On a fail, output of the test leads quickly to the origin of the fault

@arogge arogge changed the base branch from master to bareos-23 December 11, 2023 09:29
Copy link
Contributor

@sebsura sebsura left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great!

@arogge arogge force-pushed the dev/arogge/bareos-23/better-plugin-config branch from 138d709 to afde43a Compare December 11, 2023 21:43
arogge and others added 10 commits December 11, 2023 22:59
This patch adds bVarUsedConfig that provides the path to the
configuration that the fd uses. This will contain something like
`/etc/bareos/bareos-fd.d/*/*.conf`.

(cherry picked from commit 399b037)
this patch extends BareosFdPluginBaseclass to provide a standard way to
work with plugin configuration files.

When the plugin options parser encounters one of the options
defaults_file or overrides_file, it will treat the values as a path to
an ini-style configuration file and will try to read it. The resulting
options are added with precedence overrides_file, plugin definition,
defaults_file.
The code will consume the defaults_file and overrides_file options, so
the plugin will not see them later.

(cherry picked from commit de1dd5b)
by adding a transform (currently only "enc") to an option name, the
python baseclass will now decode the value.
i.e. if you configure `password#enc=E+*g/GAhM4` you will end up with
the option password containing the value "password".

(cherry picked from commit 82193f5)
the dictionaries in the module were previously filled with arbitrary
numbers that matched what we had in the enums.
With this patch we now export the enum value itself, so no mismatches
can happen.
The patch also converts the filetype defines into an enum.

(cherry picked from commit 5082c11)
We now encode with b85encode instead of a85encode. The major difference
is the set of characters used to represent the result. While a85encode
will use a colon (:) that is also used as an option separator in the
plugindef, b85encode will not.
As a result values encoded with b85encode will be simpler to use.

(cherry picked from commit 4b2e151)
(cherry picked from commit 62a3b07)
@BareosBot BareosBot force-pushed the dev/arogge/bareos-23/better-plugin-config branch from edb5481 to eed4a20 Compare December 11, 2023 22:59
@BareosBot BareosBot merged commit 5a9052a into bareos:bareos-23 Dec 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants