diff options
| author | John Estabrook <jestabro@vyos.io> | 2026-05-28 08:40:57 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-05-28 08:40:57 -0500 |
| commit | d4bb72161387132475e68c9186419f0384c28b32 (patch) | |
| tree | 2642e3042134e5d45dc888bac7fb3bfa27500f81 /src/utils | |
| parent | 07410437cde7b1df74cf62343a47549051279f08 (diff) | |
| parent | 8aa9fe5d526e3a7432959e60216ca3363bde90fb (diff) | |
| download | vyos-1x-d4bb72161387132475e68c9186419f0384c28b32.tar.gz vyos-1x-d4bb72161387132475e68c9186419f0384c28b32.zip | |
Merge pull request #5169 from jestabro/exclusive-mask-config-sync
T8502: Add exclusion mask to config-sync
Diffstat (limited to 'src/utils')
| -rwxr-xr-x | src/utils/add-config-sync-exclude-paths.py | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/utils/add-config-sync-exclude-paths.py b/src/utils/add-config-sync-exclude-paths.py new file mode 100755 index 000000000..54a209490 --- /dev/null +++ b/src/utils/add-config-sync-exclude-paths.py @@ -0,0 +1,29 @@ +#!/usr/bin/env python3 + +import sys +import json +import argparse + +parser = argparse.ArgumentParser() +parser.add_argument('--file', default='data/config-sync-exclude.json') +parser.add_argument('--paths', nargs='+') + +args = parser.parse_args() +paths = args.paths +file = args.file + +try: + with open(file) as f: + exclude_str = json.load(f) +except FileNotFoundError: + print(f'Adding new file: {file}') + exclude_str = [] +except json.JSONDecodeError as e: + sys.exit(e) + +for path in (paths or []): + exclude_str.append(path.split()) + +with open(file, 'w') as f: + json.dump(exclude_str, f, indent=1) + f.write('\n') |
