summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorScott Moser <smoser@ubuntu.com>2012-01-17 15:22:47 -0500
committerScott Moser <smoser@ubuntu.com>2012-01-17 15:22:47 -0500
commitd778a9e6e070d7aa989e49cc517e5087d1a4c795 (patch)
tree46e7f4f1cbc89fa6f0a9f2775b60082424c62ef3
parentb058de97fd80f0e9bee3eeaa26ab2a83404d77e6 (diff)
downloadvyos-cloud-init-d778a9e6e070d7aa989e49cc517e5087d1a4c795.tar.gz
vyos-cloud-init-d778a9e6e070d7aa989e49cc517e5087d1a4c795.zip
remove need for global pylint disable of W0402
This is actually a pylint bug, but it considers use of string.letters and string.whitespace deprecated.
-rw-r--r--cloudinit/CloudConfig/cc_mounts.py4
-rw-r--r--cloudinit/CloudConfig/cc_set_passwords.py8
2 files changed, 6 insertions, 6 deletions
diff --git a/cloudinit/CloudConfig/cc_mounts.py b/cloudinit/CloudConfig/cc_mounts.py
index dbd9c454..2fa57362 100644
--- a/cloudinit/CloudConfig/cc_mounts.py
+++ b/cloudinit/CloudConfig/cc_mounts.py
@@ -18,7 +18,7 @@
import cloudinit.util as util
import os
import re
-import string
+from string import whitespace # pylint: disable=W0402
def is_mdname(name):
@@ -139,7 +139,7 @@ def handle(_name, cfg, cloud, log, _args):
fstab_lines = []
fstab = open("/etc/fstab", "r+")
- ws = re.compile("[%s]+" % string.whitespace)
+ ws = re.compile("[%s]+" % whitespace)
for line in fstab.read().splitlines():
try:
toks = ws.split(line)
diff --git a/cloudinit/CloudConfig/cc_set_passwords.py b/cloudinit/CloudConfig/cc_set_passwords.py
index 05384f4f..f40544b3 100644
--- a/cloudinit/CloudConfig/cc_set_passwords.py
+++ b/cloudinit/CloudConfig/cc_set_passwords.py
@@ -19,7 +19,7 @@
import cloudinit.util as util
import sys
import random
-import string
+from string import letters, digits # pylint: disable=W0402
def handle(_name, cfg, _cloud, log, args):
@@ -117,11 +117,11 @@ def handle(_name, cfg, _cloud, log, args):
return
-def rand_str(strlen=32, select_from=string.letters + string.digits):
+def rand_str(strlen=32, select_from=letters + digits):
return("".join([random.choice(select_from) for _x in range(0, strlen)]))
def rand_user_password(pwlen=9):
- selfrom = (string.letters.translate(None, 'loLOI') +
- string.digits.translate(None, '01'))
+ selfrom = (letters.translate(None, 'loLOI') +
+ digits.translate(None, '01'))
return(rand_str(pwlen, select_from=selfrom))