summaryrefslogtreecommitdiff
path: root/cloudinit/config/cc_mounts.py
diff options
context:
space:
mode:
authorJoshua Harlow <harlowja@yahoo-inc.com>2012-06-20 17:13:55 -0700
committerJoshua Harlow <harlowja@yahoo-inc.com>2012-06-20 17:13:55 -0700
commitec4bdc4fb8d8d3a8f8b4f498eb47eac740485ede (patch)
tree306886dd731180f1c51583679a7bb33c7c7f10d8 /cloudinit/config/cc_mounts.py
parent5c5525b35970611a5c4dbd44c5c6b6e2d57556cb (diff)
downloadvyos-cloud-init-ec4bdc4fb8d8d3a8f8b4f498eb47eac740485ede.tar.gz
vyos-cloud-init-ec4bdc4fb8d8d3a8f8b4f498eb47eac740485ede.zip
Massive pylint + pep8 fixups!
Diffstat (limited to 'cloudinit/config/cc_mounts.py')
-rw-r--r--cloudinit/config/cc_mounts.py13
1 files changed, 6 insertions, 7 deletions
diff --git a/cloudinit/config/cc_mounts.py b/cloudinit/config/cc_mounts.py
index 700fbc44..ab097c2a 100644
--- a/cloudinit/config/cc_mounts.py
+++ b/cloudinit/config/cc_mounts.py
@@ -24,10 +24,10 @@ import re
from cloudinit import util
-# shortname matches 'sda', 'sda1', 'xvda', 'hda', 'sdb', xvdb, vda, vdd1
-shortname_filter = r"^[x]{0,1}[shv]d[a-z][0-9]*$"
-shortname = re.compile(shortname_filter)
-ws = re.compile("[%s]+" % (whitespace))
+# Shortname matches 'sda', 'sda1', 'xvda', 'hda', 'sdb', xvdb, vda, vdd1
+SHORTNAME_FILTER = r"^[x]{0,1}[shv]d[a-z][0-9]*$"
+SHORTNAME = re.compile(SHORTNAME_FILTER)
+WS = re.compile("[%s]+" % (whitespace))
def is_mdname(name):
@@ -55,7 +55,6 @@ def handle(_name, cfg, cloud, log, _args):
if "mounts" in cfg:
cfgmnt = cfg["mounts"]
-
for i in range(len(cfgmnt)):
# skip something that wasn't a list
if not isinstance(cfgmnt[i], list):
@@ -85,7 +84,7 @@ def handle(_name, cfg, cloud, log, _args):
cfgmnt[i][0] = renamed
log.debug("Mapped metadata name %s to %s", startname, renamed)
else:
- if shortname.match(startname):
+ if SHORTNAME.match(startname):
renamed = "/dev/%s" % startname
log.debug("Mapped shortname name %s to %s", startname, renamed)
cfgmnt[i][0] = renamed
@@ -171,7 +170,7 @@ def handle(_name, cfg, cloud, log, _args):
fstab = util.load_file(cloud.paths.join(True, "/etc/fstab"))
for line in fstab.splitlines():
try:
- toks = ws.split(line)
+ toks = WS.split(line)
if toks[3].find(comment) != -1:
continue
except: