mirror of
https://github.com/netinvent/npbackup.git
synced 2025-02-24 14:35:36 +08:00
Add deletion function to ruamel.yaml dicts
This commit is contained in:
parent
16d0ca3e6d
commit
be5096d652
1 changed files with 14 additions and 5 deletions
|
@ -83,8 +83,22 @@ def s(self, path, value, sep='.'):
|
||||||
data = data[key]
|
data = data[key]
|
||||||
data[lastkey] = value
|
data[lastkey] = value
|
||||||
|
|
||||||
|
def d(self, path, sep='.'):
|
||||||
|
"""
|
||||||
|
Deletion for dot notation in a dict/OrderedDict
|
||||||
|
d.d('my.array.keys')
|
||||||
|
"""
|
||||||
|
data = self
|
||||||
|
keys = path.split(sep)
|
||||||
|
lastkey = keys[-1]
|
||||||
|
for key in keys[:-1]:
|
||||||
|
data = data[key]
|
||||||
|
data.pop(lastkey)
|
||||||
|
|
||||||
|
|
||||||
ordereddict.g = g
|
ordereddict.g = g
|
||||||
ordereddict.s = s
|
ordereddict.s = s
|
||||||
|
ordereddict.d = d
|
||||||
|
|
||||||
# NPF-SEC-00003: Avoid password command divulgation
|
# NPF-SEC-00003: Avoid password command divulgation
|
||||||
ENCRYPTED_OPTIONS = [
|
ENCRYPTED_OPTIONS = [
|
||||||
|
@ -354,11 +368,6 @@ def get_repo_config(full_config: dict, repo_name: str = 'default', eval_variable
|
||||||
# In other cases, just keep repo confg
|
# In other cases, just keep repo confg
|
||||||
_config_inheritance.s(key, False)
|
_config_inheritance.s(key, False)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return _repo_config, _config_inheritance
|
return _repo_config, _config_inheritance
|
||||||
return _inherit_group_settings(_repo_config, _group_config, _config_inheritance)
|
return _inherit_group_settings(_repo_config, _group_config, _config_inheritance)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue