summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2019-10-27 23:04:59 +0100
committerChristian Poessinger <christian@poessinger.com>2019-10-27 23:57:10 +0100
commitb86f1d702e3b67774d3a2eec1f9fa83108711798 (patch)
treea97b33421c77f3195572334ab2eb5231f8801001 /src
parenta4230349ed5776a17e934ef5321d39289cf2c511 (diff)
downloadvyos-1x-b86f1d702e3b67774d3a2eec1f9fa83108711798.tar.gz
vyos-1x-b86f1d702e3b67774d3a2eec1f9fa83108711798.zip
snmp: T1738: cleanup import statements
Diffstat (limited to 'src')
-rwxr-xr-xsrc/conf_mode/snmp.py18
1 files changed, 8 insertions, 10 deletions
diff --git a/src/conf_mode/snmp.py b/src/conf_mode/snmp.py
index 74c17fff6..5a0c679c5 100755
--- a/src/conf_mode/snmp.py
+++ b/src/conf_mode/snmp.py
@@ -16,19 +16,17 @@
import sys
import os
-import shutil
import stat
import pwd
-import time
-
import jinja2
-import random
-import binascii
import re
import vyos.version
import vyos.validate
+from binascii import hexlify
+from shutil import move
+from time import sleep
from vyos.config import Config
from vyos import ConfigError
@@ -257,10 +255,10 @@ def get_config():
version_data = vyos.version.get_version_data()
snmp['version'] = version_data['version']
- # create an internal snmpv3 user of the form 'vyattaxxxxxxxxxxxxxxxx'
+ # create an internal snmpv3 user of the form 'vyosxxxxxxxxxxxxxxxx'
# os.urandom(8) returns 8 bytes of random data
- snmp['vyos_user'] = 'vyatta' + binascii.hexlify(os.urandom(8)).decode('utf-8')
- snmp['vyos_user_pass'] = binascii.hexlify(os.urandom(16)).decode('utf-8')
+ snmp['vyos_user'] = 'vyos' + hexlify(os.urandom(8)).decode('utf-8')
+ snmp['vyos_user_pass'] = hexlify(os.urandom(16)).decode('utf-8')
if conf.exists('community'):
for name in conf.list_nodes('community'):
@@ -723,7 +721,7 @@ def apply(snmp):
if os.path.exists(volatiledir) and os.path.isdir(volatiledir):
files = os.listdir(volatiledir)
for f in files:
- shutil.move(volatiledir + '/' + f, nonvolatiledir)
+ move(volatiledir + '/' + f, nonvolatiledir)
os.chmod(nonvolatiledir + '/' + f, stat.S_IWUSR | stat.S_IRUSR)
os.rmdir(volatiledir)
@@ -744,7 +742,7 @@ def apply(snmp):
snmpReady = False
while not snmpReady:
while not os.path.exists(config_file_user):
- time.sleep(1)
+ sleep(1)
with open(config_file_user, 'r') as f:
for line in f: