summaryrefslogtreecommitdiff
path: root/cloudinit/util.py
diff options
context:
space:
mode:
authorScott Moser <smoser@ubuntu.com>2014-01-24 15:29:09 -0500
committerScott Moser <smoser@ubuntu.com>2014-01-24 15:29:09 -0500
commit4919cd124e57e82ecfcdaa9bfcbc051c719708e6 (patch)
treeae602a3a99ee5c5181bba9f80c3c02a6f1afc4f4 /cloudinit/util.py
parent6d474342163b05a29c198964ececd57db8658365 (diff)
downloadvyos-cloud-init-4919cd124e57e82ecfcdaa9bfcbc051c719708e6.tar.gz
vyos-cloud-init-4919cd124e57e82ecfcdaa9bfcbc051c719708e6.zip
pylint and long line fixes.
This fixes up many long lines to be < 80 chars and some other pylint issues. pylint 1.1 (in trusty) is now complaining about the lazy logging, so I'll clean that up when I touch things.
Diffstat (limited to 'cloudinit/util.py')
-rw-r--r--cloudinit/util.py12
1 files changed, 7 insertions, 5 deletions
diff --git a/cloudinit/util.py b/cloudinit/util.py
index e1263f47..d350ba08 100644
--- a/cloudinit/util.py
+++ b/cloudinit/util.py
@@ -963,7 +963,7 @@ def is_resolvable(name):
pass
_DNS_REDIRECT_IP = badips
if badresults:
- LOG.debug("detected dns redirection: %s" % badresults)
+ LOG.debug("detected dns redirection: %s", badresults)
try:
result = socket.getaddrinfo(name, None)
@@ -1322,6 +1322,7 @@ def mounts():
(mountoutput, _err) = subp("mount")
mount_locs = mountoutput.splitlines()
method = 'mount'
+ mountre = r'^(/dev/[\S]+) on (/.*) \((.+), .+, (.+)\)$'
for mpline in mount_locs:
# Linux: /dev/sda1 on /boot type ext4 (rw,relatime,data=ordered)
# FreeBSD: /dev/vtbd0p2 on / (ufs, local, journaled soft-updates)
@@ -1329,7 +1330,7 @@ def mounts():
if method == 'proc':
(dev, mp, fstype, opts, _freq, _passno) = mpline.split()
else:
- m = re.search('^(/dev/[\S]+) on (/.*) \((.+), .+, (.+)\)$', mpline)
+ m = re.search(mountre, mpline)
dev = m.group(1)
mp = m.group(2)
fstype = m.group(3)
@@ -1403,7 +1404,7 @@ def get_builtin_cfg():
def sym_link(source, link):
- LOG.debug("Creating symbolic link from %r => %r" % (link, source))
+ LOG.debug("Creating symbolic link from %r => %r", link, source)
os.symlink(source, link)
@@ -1444,7 +1445,8 @@ def uptime():
size = ctypes.c_size_t()
buf = ctypes.c_int()
size.value = ctypes.sizeof(buf)
- libc.sysctlbyname("kern.boottime", ctypes.byref(buf), ctypes.byref(size), None, 0)
+ libc.sysctlbyname("kern.boottime", ctypes.byref(buf),
+ ctypes.byref(size), None, 0)
now = time.time()
bootup = buf.value
uptime_str = now - bootup
@@ -1793,7 +1795,7 @@ def parse_mount(path):
(mountoutput, _err) = subp("mount")
mount_locs = mountoutput.splitlines()
for line in mount_locs:
- m = re.search('^(/dev/[\S]+) on (/.*) \((.+), .+, (.+)\)$', line)
+ m = re.search(r'^(/dev/[\S]+) on (/.*) \((.+), .+, (.+)\)$', line)
devpth = m.group(1)
mount_point = m.group(2)
fs_type = m.group(3)