Skip to content

config: fix issues with config directive aliases#2159

Merged
BareosBot merged 11 commits intobareos:masterfrom
florian-at-bareos:dev/fburger/bconsole-config-address
Feb 28, 2025
Merged

config: fix issues with config directive aliases#2159
BareosBot merged 11 commits intobareos:masterfrom
florian-at-bareos:dev/fburger/bconsole-config-address

Conversation

@florian-at-bareos
Copy link
Contributor

@florian-at-bareos florian-at-bareos commented Feb 7, 2025

Fixes internal issue#167

Currently, aliases are defined as new directives with the flag CFG_ITEM_ALIAS.
The problem with this approach is that nowhere is specified which directive this is an alias to.
This information is important, e.g. if the original directive is marked as CFG_ITEM_REQUIRED, because specifying one of its aliases should suffice the requirement.
Also, outputting the parsed config wasn't working with aliases, because they were simply skipped.

To solve this i added a new member ResourceItem::aliases (std::set<std::string>) to track the aliases of a directive.

This PR

  • marks 'Address' (Console -> Director) as required (currently, not specifying the 'Address' passes the config parsing successfully but then always crashes when trying to connect to the director since address is NULL)
  • introduces a new alias 'DirAddress' (Console -> Director) for it
  • makes the config parser output a warning if aliases are being used (the bconsole does not output config warnings currently, changed that)
  • replaces all config aliases used in (system)tests

Thank you for contributing to the Bareos Project!

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
    Required backport PRs have been created
  • Correct milestone is set
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

@florian-at-bareos
Copy link
Contributor Author

I still need to fix the documentation for the aliases.

@florian-at-bareos florian-at-bareos force-pushed the dev/fburger/bconsole-config-address branch from d1ce668 to 5b72a4a Compare February 10, 2025 13:30
@florian-at-bareos florian-at-bareos added the bug This addresses a bug label Feb 11, 2025
@florian-at-bareos florian-at-bareos force-pushed the dev/fburger/bconsole-config-address branch 3 times, most recently from beff7e0 to 4fbe53f Compare February 13, 2025 09:58
@florian-at-bareos florian-at-bareos marked this pull request as ready for review February 13, 2025 10:40
@florian-at-bareos florian-at-bareos force-pushed the dev/fburger/bconsole-config-address branch from 4fbe53f to 0e4c42c Compare February 13, 2025 12:01
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.

This looks very good. Nice work!

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.

Great Work!

@sebsura sebsura added this to the 25.0.0 milestone Feb 24, 2025
florian-at-bareos and others added 11 commits February 28, 2025 11:07
Adjust aliases like agreed with the team:

Director -> Client
- FdAddress is an alias for Address
- FdPort is an alias for Port
- FdPassword is an alias for Password

Director -> Storage
- SdAddress is an alias for Address
- SdPort is an alias for Port
- SdPassword is an alias for Password

Director -> Catalog
- Address is an alias for DbAddress
- Port is an alias for DbPort
- User is an alias for DbUser
- Password is an alias for DbPassword
- Socket is an alias for DbSocket

Console -> Director
- DirAddress is an alias for Address
- DirPort is an alias for Port
@BareosBot BareosBot force-pushed the dev/fburger/bconsole-config-address branch from c977fe0 to 74f0835 Compare February 28, 2025 11:07
@BareosBot BareosBot merged commit 58aa9e0 into bareos:master Feb 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug This addresses a bug enhancement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants