diff options
-rw-r--r-- | cloudinit/CloudConfig/cc_mounts.py | 4 | ||||
-rw-r--r-- | cloudinit/CloudConfig/cc_set_passwords.py | 8 |
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)) |