mirror of
https://github.com/netinvent/npbackup.git
synced 2025-02-24 06:25:17 +08:00
Fix configuration inheritance for false repo booleans
This commit is contained in:
parent
27d91a9014
commit
52951925b0
1 changed files with 5 additions and 5 deletions
|
@ -7,7 +7,7 @@ __intname__ = "npbackup.configuration"
|
||||||
__author__ = "Orsiris de Jong"
|
__author__ = "Orsiris de Jong"
|
||||||
__copyright__ = "Copyright (C) 2022-2024 NetInvent"
|
__copyright__ = "Copyright (C) 2022-2024 NetInvent"
|
||||||
__license__ = "GPL-3.0-only"
|
__license__ = "GPL-3.0-only"
|
||||||
__build__ = "2024051501"
|
__build__ = "2024052201"
|
||||||
__version__ = "npbackup 3.0.0+"
|
__version__ = "npbackup 3.0.0+"
|
||||||
|
|
||||||
MIN_CONF_VERSION = 3.0
|
MIN_CONF_VERSION = 3.0
|
||||||
|
@ -529,7 +529,7 @@ def get_repo_config(
|
||||||
_repo_config: dict, _group_config: dict, _config_inheritance: dict
|
_repo_config: dict, _group_config: dict, _config_inheritance: dict
|
||||||
) -> Tuple[dict, dict]:
|
) -> Tuple[dict, dict]:
|
||||||
if isinstance(_group_config, dict):
|
if isinstance(_group_config, dict):
|
||||||
if not _repo_config:
|
if _repo_config is None:
|
||||||
# Initialize blank if not set
|
# Initialize blank if not set
|
||||||
_repo_config = CommentedMap()
|
_repo_config = CommentedMap()
|
||||||
_config_inheritance = CommentedMap()
|
_config_inheritance = CommentedMap()
|
||||||
|
@ -586,14 +586,14 @@ def get_repo_config(
|
||||||
_config_inheritance.g(key)[v] = False
|
_config_inheritance.g(key)[v] = False
|
||||||
else:
|
else:
|
||||||
# repo_config may or may not already contain data
|
# repo_config may or may not already contain data
|
||||||
if not _repo_config:
|
if _repo_config is None:
|
||||||
_repo_config = CommentedMap()
|
_repo_config = CommentedMap()
|
||||||
_config_inheritance = CommentedMap()
|
_config_inheritance = CommentedMap()
|
||||||
if not _repo_config.g(key):
|
if _repo_config.g(key) is None:
|
||||||
_repo_config.s(key, value)
|
_repo_config.s(key, value)
|
||||||
_config_inheritance.s(key, True)
|
_config_inheritance.s(key, True)
|
||||||
# Case where repo_config contains list but group info has single str
|
# Case where repo_config contains list but group info has single str
|
||||||
elif isinstance(_repo_config.g(key), list) and value:
|
elif isinstance(_repo_config.g(key), list) and value is not None:
|
||||||
merged_lists = _repo_config.g(key) + [value]
|
merged_lists = _repo_config.g(key) + [value]
|
||||||
|
|
||||||
# Special case when merged lists contain multiple dicts, we'll need to merge dicts
|
# Special case when merged lists contain multiple dicts, we'll need to merge dicts
|
||||||
|
|
Loading…
Reference in a new issue