diff options
author | Christian Poessinger <christian@poessinger.com> | 2021-04-02 22:46:46 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-02 22:46:46 +0200 |
commit | 810f4700acc9816178dc9a7f5f555bbde71a141d (patch) | |
tree | 46baa5af5c52fde8a6f2ea3bf5be560d1fce0a0b /python/vyos/frr.py | |
parent | b4fdcebebecd8d8952211b78bce26d53fd29edb3 (diff) | |
parent | d9d923ea4e0bbe0cc154dc2fbdd626585b5d7449 (diff) | |
download | vyos-1x-810f4700acc9816178dc9a7f5f555bbde71a141d.tar.gz vyos-1x-810f4700acc9816178dc9a7f5f555bbde71a141d.zip |
Merge pull request #798 from sever-sever/T3217
frr: T3217: Ability to save routing configs
Diffstat (limited to 'python/vyos/frr.py')
-rw-r--r-- | python/vyos/frr.py | 25 |
1 files changed, 6 insertions, 19 deletions
diff --git a/python/vyos/frr.py b/python/vyos/frr.py index 668489636..de3dbe6e9 100644 --- a/python/vyos/frr.py +++ b/python/vyos/frr.py @@ -69,6 +69,7 @@ import tempfile import re from vyos import util from vyos.util import chown +from vyos.util import cmd import logging from logging.handlers import SysLogHandler import os @@ -209,28 +210,14 @@ def reload_configuration(config, daemon=None): return output -def save_configuration(daemon=None): - """Save FRR configuration to /run/frr/{daemon}.conf - It save configuration on each commit. +def save_configuration(): + """Save FRR configuration to /run/frr/config/frr.conf + It save configuration on each commit. T3217 """ - if daemon and daemon not in _frr_daemons: - raise ValueError(f'The specified daemon type is not supported {repr(daemon)}') - - cmd = f"{path_vtysh} -d {daemon} -c 'show run no-header'" - output, code = util.popen(cmd, stderr=util.STDOUT) - if code: - raise OSError(code, output) - daemon_conf = f'{path_config}/{daemon}.conf' + cmd(f'{path_vtysh} -n -w') - with open(daemon_conf, "w") as f: - f.write(output) - # Set permissions (frr:frr) for /run/frr/{daemon}.conf - if os.path.exists(daemon_conf): - chown(daemon_conf, 'frr', 'frr') - config = output - - return config + return def execute(command): |