diff options
author | Daniil Baturin <daniil@vyos.io> | 2023-12-24 16:32:42 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-12-24 16:32:42 +0000 |
commit | 50ec7b3cd28d1dec1592a141f4eaf2e5c7082ba3 (patch) | |
tree | 24cec085446ad14b5ec329258602ef6dc7a29ad8 | |
parent | 111da0019bd6dd0f418e7aba77de49876b873389 (diff) | |
parent | d56256fffa164513829a1b6653d14fa43baa38af (diff) | |
download | vyos-1x-50ec7b3cd28d1dec1592a141f4eaf2e5c7082ba3.tar.gz vyos-1x-50ec7b3cd28d1dec1592a141f4eaf2e5c7082ba3.zip |
Merge pull request #2684 from vyos/mergify/bp/sagitta/pr-2683
snmp: 5856: fix service removal error (backport #2683)
-rwxr-xr-x | src/conf_mode/snmp.py | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/src/conf_mode/snmp.py b/src/conf_mode/snmp.py index 7882f8510..38b5d52f9 100755 --- a/src/conf_mode/snmp.py +++ b/src/conf_mode/snmp.py @@ -1,6 +1,6 @@ #!/usr/bin/env python3 # -# Copyright (C) 2018-2021 VyOS maintainers and contributors +# Copyright (C) 2018-2023 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 @@ -86,7 +86,7 @@ def get_config(config=None): return snmp def verify(snmp): - if not snmp: + if 'deleted' in snmp: return None if {'deleted', 'lldp_snmp'} <= set(snmp): @@ -178,8 +178,6 @@ def verify(snmp): return None def generate(snmp): - - # # As we are manipulating the snmpd user database we have to stop it first! # This is even save if service is going to be removed call(f'systemctl stop {systemd_service}') @@ -190,7 +188,7 @@ def generate(snmp): if os.path.isfile(file): os.unlink(file) - if not snmp: + if 'deleted' in snmp: return None if 'v3' in snmp: @@ -244,7 +242,7 @@ def apply(snmp): # Always reload systemd manager configuration call('systemctl daemon-reload') - if not snmp: + if 'deleted' in snmp: return None # start SNMP daemon @@ -257,9 +255,7 @@ def apply(snmp): 'bgpd', 'ospf6d', 'ospfd', 'ripd', 'ripngd', 'isisd', 'ldpd', 'zebra' ] for frr_daemon in frr_daemons_list: - call( - f'vtysh -c "configure terminal" -d {frr_daemon} -c "agentx" >/dev/null' - ) + call(f'vtysh -c "configure terminal" -d {frr_daemon} -c "agentx" >/dev/null') return None |