diff options
Diffstat (limited to 'src/conf_mode')
-rwxr-xr-x | src/conf_mode/snmp.py | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/src/conf_mode/snmp.py b/src/conf_mode/snmp.py index e6253b2a8..c6f408329 100755 --- a/src/conf_mode/snmp.py +++ b/src/conf_mode/snmp.py @@ -1,6 +1,6 @@ #!/usr/bin/env python3 # -# Copyright (C) 2018-2019 VyOS maintainers and contributors +# Copyright (C) 2018-2020 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 @@ -14,20 +14,17 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. -import sys import os -import stat -import pwd import jinja2 -import re import vyos.version import vyos.validate from binascii import hexlify -from shutil import move from time import sleep -from stat import S_IRWXU,S_IXGRP,S_IXOTH,S_IROTH,S_IRGRP +from stat import S_IRWXU, S_IXGRP, S_IXOTH, S_IROTH, S_IRGRP +from sys import exit + from vyos.config import Config from vyos import ConfigError @@ -45,6 +42,7 @@ OIDs = { 'des' : '.1.3.6.1.6.3.10.1.2.2', 'none': '.1.3.6.1.6.3.10.1.2.1' } + # SNMP template (/etc/snmp/snmp.conf) - be careful if you edit the template. client_config_tmpl = """ ### Autogenerated by snmp.py ### @@ -550,7 +548,7 @@ def verify(snmp): if not os.path.isfile(ext['script']): print ("WARNING: script: {} doesn't exist".format(ext['script'])) else: - os.chmod(ext['script'], S_IRWXU|S_IXGRP|S_IXOTH|S_IROTH|S_IRGRP) + os.chmod(ext['script'], S_IRWXU | S_IXGRP | S_IXOTH | S_IROTH | S_IRGRP) for listen in snmp['listen_address']: addr = listen[0] @@ -800,4 +798,4 @@ if __name__ == '__main__': apply(c) except ConfigError as e: print(e) - sys.exit(1) + exit(1) |