diff options
| author | Nataliia S. <81954790+natali-rs1985@users.noreply.github.com> | 2025-08-19 11:04:38 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-08-19 11:04:38 +0200 |
| commit | 3bfcf335c5f16a6c814710b01f38342c40f85a8d (patch) | |
| tree | efa1d64693f8851c31b6b1851967fb9e9d6cd2b2 /src | |
| parent | 96fb2848e61cc5de677d9e6ad7f5c55ae397a698 (diff) | |
| parent | 69cd4845861c88285ab496339f19103dec7a32b6 (diff) | |
| download | vyos-1x-3bfcf335c5f16a6c814710b01f38342c40f85a8d.tar.gz vyos-1x-3bfcf335c5f16a6c814710b01f38342c40f85a8d.zip | |
Merge branch 'current' into T7678
Diffstat (limited to 'src')
| -rwxr-xr-x | src/conf_mode/vpp.py | 3 | ||||
| -rwxr-xr-x | src/helpers/vyos-save-config.py | 16 | ||||
| -rw-r--r-- | src/services/api/rest/routers.py | 6 |
3 files changed, 20 insertions, 5 deletions
diff --git a/src/conf_mode/vpp.py b/src/conf_mode/vpp.py index ace3c9f9f..966158ab7 100755 --- a/src/conf_mode/vpp.py +++ b/src/conf_mode/vpp.py @@ -52,6 +52,7 @@ from vyos.vpp.config_verify import ( verify_vpp_memory, verify_vpp_statseg_size, verify_vpp_interfaces_dpdk_num_queues, + verify_routes_count, ) from vyos.vpp.config_filter import iface_filter_eth from vyos.vpp.utils import EthtoolGDrvinfo @@ -460,6 +461,8 @@ def verify(config): f'Interface {iface_config["iface_name"]} is an xconnect member and cannot be removed' ) + verify_routes_count(config['settings'], workers) + def generate(config): if not config or ('removed_ifaces' in config and 'settings' not in config): diff --git a/src/helpers/vyos-save-config.py b/src/helpers/vyos-save-config.py index adf62b71d..fa1f5625d 100755 --- a/src/helpers/vyos-save-config.py +++ b/src/helpers/vyos-save-config.py @@ -23,15 +23,18 @@ from argparse import ArgumentParser from vyos.config import Config from vyos.remote import urlc -from vyos.component_version import add_system_version +from vyos.component_version import add_system_version_string from vyos.defaults import directories +from vyos.utils.file import write_file_atomic DEFAULT_CONFIG_PATH = os.path.join(directories['config'], 'config.boot') remote_save = None parser = ArgumentParser(description='Save configuration') parser.add_argument('file', type=str, nargs='?', help='Save configuration to file') -parser.add_argument('--write-json-file', type=str, help='Save JSON of configuration to file') +parser.add_argument( + '--write-json-file', type=str, help='Save JSON of configuration to file' +) args = parser.parse_args() file = args.file json_file = args.write_json_file @@ -56,7 +59,14 @@ write_file = save_file if remote_save is None else NamedTemporaryFile(delete=Fal # config_tree is None before boot configuration is complete; # automated saves should check boot_configuration_complete config_str = None if ct is None else ct.to_string() -add_system_version(config_str, write_file) +versioned_config_str = add_system_version_string(config_str) + +try: + with write_file_atomic(write_file) as f: + f.write(versioned_config_str) +except OSError as e: + print(f'failed to write config file: {e}') + sys.exit(1) if json_file is not None and ct is not None: try: diff --git a/src/services/api/rest/routers.py b/src/services/api/rest/routers.py index 329d6e51f..d1383a356 100644 --- a/src/services/api/rest/routers.py +++ b/src/services/api/rest/routers.py @@ -511,12 +511,14 @@ async def configure_op( @router.post('/configure-section') -def configure_section_op( +async def configure_section_op( data: Union[ConfigSectionModel, ConfigSectionListModel, ConfigSectionTreeModel], request: Request, background_tasks: BackgroundTasks, ): - return _configure_op(data, request, background_tasks) + out = await _configure_op(data, request, background_tasks) + + return out @router.post('/retrieve') |
