Skip to content

Conversation

@jhiemstrawisc
Copy link
Member

Because config defaults from the defaults yamls don't work with automatic
deprecation mapping, I wanted a way to make sure any time a param is
deprecated its replacement keys won't be configured via these files.

After a quick chat with other Pelican devs, we decided the best way to
do this would be a unit test that fails if a deprecated config replacement
key is found in one of the defaults yaml files.

This test fails in those cases, and also checks an intentionally-bad
yaml string to make sure these keys are in fact caught in the
first place.

The underlying issue was that defaults from defaults.yaml or osdfDefaults.yaml
do not show up to Viper as being defaults, rather they appear as user-supplied.
For a deprecated key like DisableHttpProxy that's replaced by Client.DisableHttpProxy,
we only map the value for the deprecated key as the value for the new key if
the new key is not set by the user. This means that when replacement keys are
defined in the default yamls, we weren't doing the mapping.

@jhiemstrawisc jhiemstrawisc requested a review from h2zh October 30, 2025 20:52
@jhiemstrawisc jhiemstrawisc added bug Something isn't working internal Internal code improvements, not user-facing configuration labels Oct 30, 2025
@jhiemstrawisc jhiemstrawisc force-pushed the issue-1870 branch 2 times, most recently from 0dd5910 to 8829f76 Compare October 30, 2025 22:00
…faults yamls

Because config defaults from the defaults yamls don't work with automatic
deprecation mapping, I wanted a way to make sure any time a param is
deprecated its replacement keys won't be configured via these files.

After a quick chat with other Pelican devs, we decided the best way to
do this would be a unit test that fails if a deprecated config replacement
key is found in one of the defaults yaml files.

This test fails in those cases, and also checks an intentionally-bad
yaml string to make sure these keys are in fact caught in the
first place.

The underlying issue was that defaults from `defaults.yaml` or `osdfDefaults.yaml`
do not show up to Viper as being defaults, rather they appear as user-supplied.
For a deprecated key like `DisableHttpProxy` that's replaced by `Client.DisableHttpProxy`,
we only map the value for the deprecated key as the value for the new key if
the new key is not set by the user. This means that when replacement keys are
defined in the default yamls, we weren't doing the mapping.
There was a really hacky/funky method doing this before that relied
on defaults for `Cache.Port` and `Origin.Port` being set in the
defaults yaml. I originally missed that I broke this, but a test
failure pointed at it.

Rather than stick with the hacks, which were partially used to set
a port of "any" for xrootd's auto-port section feature when the
configured Origin/Cache port was 0, I got rid of the hack by moving
the "if Origin.Port == 0, set xrootd port to 'any'" into the Cache/
Origin templates directly.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working configuration internal Internal code improvements, not user-facing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Deprecation Handling Fails with Default Values from defaults.yaml

2 participants