summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2020-02-18 16:23:12 +0100
committerChristian Poessinger <christian@poessinger.com>2020-02-18 16:23:12 +0100
commita198058b9671b41cc4552d8b27c8801c2dd8a64a (patch)
treef7e34122d19f0b7a5c352fc5e26569db28e50fa0
parent716146147046e27b0bc4439c293e4fc209ad8cae (diff)
downloadvyos-1x-a198058b9671b41cc4552d8b27c8801c2dd8a64a.tar.gz
vyos-1x-a198058b9671b41cc4552d8b27c8801c2dd8a64a.zip
snmp: T2042: import statement cleanup
-rwxr-xr-xsrc/conf_mode/snmp.py16
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)