Fix FRR 9 mgmtd crashes when applying config

The vrysh command also allows reading from file and when using
this option, it works perfectly.

Closes-Bug: #2049736

Change-Id: I6cbee6739d8dddb43118585d1c03ad3eda8e4cbf
This commit is contained in:
Michel Nederlof 2024-01-18 10:26:32 +01:00
parent 1a5b44777d
commit 0eb8861602
2 changed files with 2 additions and 3 deletions

View File

@ -23,9 +23,8 @@ LOG = logging.getLogger(__name__)
@ovn_bgp_agent.privileged.vtysh_cmd.entrypoint @ovn_bgp_agent.privileged.vtysh_cmd.entrypoint
def run_vtysh_config(frr_config_file): def run_vtysh_config(frr_config_file):
vtysh_command = "copy {} running-config".format(frr_config_file)
full_args = ['/usr/bin/vtysh', '--vty_socket', constants.FRR_SOCKET_PATH, full_args = ['/usr/bin/vtysh', '--vty_socket', constants.FRR_SOCKET_PATH,
'-c', vtysh_command] '-f', frr_config_file]
try: try:
return processutils.execute(*full_args) return processutils.execute(*full_args)
except Exception as e: except Exception as e:

View File

@ -43,7 +43,7 @@ class TestPrivilegedVtysh(test_base.TestCase):
vtysh.run_vtysh_config('/fake/frr.config') vtysh.run_vtysh_config('/fake/frr.config')
self.mock_exc.assert_called_once_with( self.mock_exc.assert_called_once_with(
'/usr/bin/vtysh', '--vty_socket', constants.FRR_SOCKET_PATH, '/usr/bin/vtysh', '--vty_socket', constants.FRR_SOCKET_PATH,
'-c', 'copy /fake/frr.config running-config') '-f', '/fake/frr.config')
def test_run_vtysh_config_exception(self): def test_run_vtysh_config_exception(self):
self.mock_exc.side_effect = FakeException() self.mock_exc.side_effect = FakeException()