diff options
author | Viacheslav Hletenko <v.gletenko@vyos.io> | 2023-12-24 15:57:52 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-12-24 15:57:52 +0200 |
commit | 8e6da6bdf7d0b9b6a562e10ed0ffd8d9d59cfeaa (patch) | |
tree | faae846a39a4a1c88361b738a2d42a111ae994a7 /src/conf_mode/snmp.py | |
parent | 6173c3f6d0b84636d0d3a2c5d65edd7b7f0aadca (diff) | |
parent | 20b98e780fda4131eb242921884d4955147ce51a (diff) | |
download | vyos-1x-8e6da6bdf7d0b9b6a562e10ed0ffd8d9d59cfeaa.tar.gz vyos-1x-8e6da6bdf7d0b9b6a562e10ed0ffd8d9d59cfeaa.zip |
Merge pull request #2683 from c-po/snmp-T5865
snmp: 5856: fix service removal error
Diffstat (limited to 'src/conf_mode/snmp.py')
-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 d2ed5414f..f1d41f23d 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 @@ -256,9 +254,7 @@ def apply(snmp): # Following daemons from FRR 9.0/stable have SNMP module compiled in VyOS frr_daemons_list = ['zebra', 'bgpd', 'ospf6d', 'ospfd', 'ripd', 'isisd', 'ldpd'] 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 |