-
Notifications
You must be signed in to change notification settings - Fork 141
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Provide default values for mirror config options (#1740)
* Provide default values for mirror config options This splits the existing 'default.conf' config file shipped with the package into two similar files: "defaults.conf" and "example.conf". "example.conf" is an exact copy of the previous "default.conf". The new "defaults.conf" is a stripped-down version containing only default values for all mirror configuration options except "mirror.directory". BandersnatchConfig is changed to *always* read defaults.conf, then read the user config file if one is specified. This leaves the ConfigParser populated with default values for any mirror options that aren't set by the user (except mirror.directory). Notable ripple effects for this include: - It is no longer meaningful to check ConfigParser.has_option with the 'mirror' section. Instead, you have to check whether the options value is empty or None. - Specifying a default/fallback value when calling .get on the 'mirror' section will have no effect, because the option will already be present in the ConfigParser mappings. As (mostly) an implementation detail, BandersnatchConfig is changed to be a subclass of ConfigParser. The BandersnatchConfig singleton can be used anywhere a ConfigParser instance is expected without having to use '.config' to access a nested ConfigParser. Fixes #1702 Fixes #990 * Update mirror configuration documentation page Add default values for options that are no longer required. * Fix unnecessary concatenation in a string literal Co-authored-by: Cooper Lees <me@cooperlees.com> --------- Co-authored-by: Cooper Lees <me@cooperlees.com>
- Loading branch information
1 parent
1561917
commit f405f48
Showing
18 changed files
with
301 additions
and
250 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
"""Exception subclasses for configuration file loading and validation.""" | ||
|
||
|
||
class ConfigError(Exception): | ||
"""Base exception for configuration file exceptions.""" | ||
|
||
pass | ||
|
||
|
||
class ConfigFileNotFound(ConfigError): | ||
"""A specified configuration file is missing or unreadable.""" | ||
|
||
pass |
Oops, something went wrong.