diff options
author | Christian Breunig <christian@breunig.cc> | 2025-04-28 21:55:17 +0200 |
---|---|---|
committer | Christian Breunig <christian@breunig.cc> | 2025-04-28 22:10:08 +0200 |
commit | b433f9d48141496926f9499808cb57067352e432 (patch) | |
tree | c84e3be5c4caca09e501e0764b2186d68cf95741 /src | |
parent | a41398d9289457794f3f2e66e1dded7804f3c080 (diff) | |
download | vyos-1x-b433f9d48141496926f9499808cb57067352e432.tar.gz vyos-1x-b433f9d48141496926f9499808cb57067352e432.zip |
pki: T7122: remove duplicate list definition - can be auto generated
changed_keys had the same content as the values inside the sync_translate
dictionary. Infact they were both used together do defined changed CLI keys.
The list for changed_keys is a list of all unique values inside the
sync_translate dict.
Diffstat (limited to 'src')
-rwxr-xr-x | src/conf_mode/pki.py | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/conf_mode/pki.py b/src/conf_mode/pki.py index 724f97555..521af61df 100755 --- a/src/conf_mode/pki.py +++ b/src/conf_mode/pki.py @@ -1,6 +1,6 @@ #!/usr/bin/env python3 # -# Copyright (C) 2021-2024 VyOS maintainers and contributors +# Copyright (C) 2021-2025 VyOS maintainers and contributors # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License version 2 or later as @@ -150,14 +150,18 @@ def get_config(config=None): if len(argv) > 1 and argv[1] == 'certbot_renew': pki['certbot_renew'] = {} - changed_keys = ['ca', 'certificate', 'dh', 'key-pair', 'openssh', 'openvpn'] + # Walk through the list of sync_translate mapping and build a list + # which is later used to check if the node was changed in the CLI config + changed_keys = [] + for value in sync_translate.values(): + if value not in changed_keys: + changed_keys.append(value) + # Check for changes to said given keys in the CLI config for key in changed_keys: tmp = node_changed(conf, base + [key], recursive=True, expand_nodes=Diff.DELETE | Diff.ADD) - if 'changed' not in pki: pki.update({'changed':{}}) - pki['changed'].update({key.replace('-', '_') : tmp}) # We only merge on the defaults of there is a configuration at all |