Clarify the whether default and required plugin configuration parameters are mutually exclusive #3911

Closed
opened 2025-12-29 18:31:56 +01:00 by adam · 3 comments
Owner

Originally created by @jeremystretch on GitHub (Jul 28, 2020).

Originally assigned to: @jeremystretch on GitHub.

Change Type

[x] Addition
[ ] Correction
[ ] Deprecation
[ ] Cleanup (formatting, typos, etc.)

Area

[ ] Installation instructions
[ ] Configuration parameters
[ ] Functionality/features
[ ] REST API
[ ] Administration/development
[x] Plugins
[ ] Other

Proposed Changes

The plugins development documentation specifies two mechanisms for defining plugin-specific configuration parameters:

  • required_settings - A list of any configuration parameters that must be defined by the user
  • default_settings - A dictionary of configuration parameters and their default values

However, it does not specify whether these lists are mutually exclusive. Is it considered valid to list a parameter in both lists? What are the implications of doing so?

Originally created by @jeremystretch on GitHub (Jul 28, 2020). Originally assigned to: @jeremystretch on GitHub. ### Change Type [x] Addition [ ] Correction [ ] Deprecation [ ] Cleanup (formatting, typos, etc.) ### Area [ ] Installation instructions [ ] Configuration parameters [ ] Functionality/features [ ] REST API [ ] Administration/development [x] Plugins [ ] Other ### Proposed Changes The plugins development documentation specifies two mechanisms for defining plugin-specific configuration parameters: * `required_settings` - A list of any configuration parameters that must be defined by the user * `default_settings` - A dictionary of configuration parameters and their default values However, it does not specify whether these lists are mutually exclusive. Is it considered valid to list a parameter in both lists? What are the implications of doing so?
adam added the status: acceptedtype: documentation labels 2025-12-29 18:31:56 +01:00
adam closed this issue 2025-12-29 18:32:02 +01:00
Author
Owner

@jmcgill298 commented on GitHub (Jul 28, 2020):

I would say that all default_settings are required, and therefore making the required_settings a special type of required options. This then makes it confusing to have the same variable defined in both sections. This also leads to unnecessary confusion about precedence order and where a user should update the setting.

@jmcgill298 commented on GitHub (Jul 28, 2020): I would say that all `default_settings` are required, and therefore making the `required_settings` a special type of required options. This then makes it confusing to have the same variable defined in both sections. This also leads to unnecessary confusion about precedence order and where a user should update the setting.
Author
Owner

@lampwins commented on GitHub (Jul 28, 2020):

We can update the wording to be more clear on the purpose and difference of the two settings, but I would shy away from phraseology like "mutually exclusive." It is not an error to define a setting in both. This is the code for default:

        # Apply default configuration values
        for setting, value in cls.default_settings.items():
            if setting not in user_config:
                user_config[setting] = value
@lampwins commented on GitHub (Jul 28, 2020): We can update the wording to be more clear on the purpose and difference of the two settings, but I would shy away from phraseology like "mutually exclusive." It is not an error to define a setting in both. This is the code for default: ```python # Apply default configuration values for setting, value in cls.default_settings.items(): if setting not in user_config: user_config[setting] = value ```
Author
Owner

@jeremystretch commented on GitHub (Jul 28, 2020):

I think confusion arises in the case where a default is provided for a required setting: An ImproperlyConfigured exception will be raised if the parameter is missing from the user's configuration even if the plugin provides a default value.

@jeremystretch commented on GitHub (Jul 28, 2020): I think confusion arises in the case where a default is provided for a required setting: An ImproperlyConfigured exception will be raised if the parameter is missing from the user's configuration even if the plugin provides a default value.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#3911