diff mbox

[ovs-dev,2/8] ovs-bugtool.in: Fix errors around spaces and line length.

Message ID 1465197959-27853-3-git-send-email-guru@ovn.org
State Accepted
Headers show

Commit Message

Gurucharan Shetty June 6, 2016, 7:25 a.m. UTC
Signed-off-by: Gurucharan Shetty <guru@ovn.org>
---
 utilities/bugtool/ovs-bugtool.in | 235 ++++++++++++++++++++++-----------------
 1 file changed, 135 insertions(+), 100 deletions(-)
diff mbox

Patch

diff --git a/utilities/bugtool/ovs-bugtool.in b/utilities/bugtool/ovs-bugtool.in
index 9e1f535..605a6bf 100755
--- a/utilities/bugtool/ovs-bugtool.in
+++ b/utilities/bugtool/ovs-bugtool.in
@@ -103,8 +103,8 @@  HOSTS_ALLOW = '/etc/hosts.allow'
 HOSTS_DENY = '/etc/hosts.deny'
 DHCP_LEASE_DIR = ['/var/lib/dhclient', '/var/lib/dhcp3']
 OPENVSWITCH_LOG_DIR = '@LOGDIR@/'
-OPENVSWITCH_DEFAULT_SWITCH = '/etc/default/openvswitch-switch' # Debian
-OPENVSWITCH_SYSCONFIG_SWITCH = '/etc/sysconfig/openvswitch'    # RHEL
+OPENVSWITCH_DEFAULT_SWITCH = '/etc/default/openvswitch-switch'  # Debian
+OPENVSWITCH_SYSCONFIG_SWITCH = '/etc/sysconfig/openvswitch'     # RHEL
 OPENVSWITCH_CONF_DB = '@DBDIR@/conf.db'
 OPENVSWITCH_COMPACT_DB = '@DBDIR@/bugtool-compact-conf.db'
 OPENVSWITCH_VSWITCHD_PID = '@RUNDIR@/ovs-vswitchd.pid'
@@ -117,7 +117,8 @@  YUM_REPOS_DIR = '/etc/yum.repos.d'
 # External programs
 #
 
-os.environ['PATH'] = '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:@pkgdatadir@/scripts'
+os.environ['PATH'] = '/usr/local/sbin:/usr/local/bin:' \
+                     '/usr/sbin:/usr/bin:/sbin:/bin:@pkgdatadir@/scripts'
 ARP = 'arp'
 CAT = 'cat'
 CHKCONFIG = 'chkconfig'
@@ -167,19 +168,19 @@  ZCAT = 'zcat'
 # scripts in dom0.
 #
 
-PII_NO            = 'no'
-PII_YES           = 'yes'
-PII_MAYBE         = 'maybe'
+PII_NO = 'no'
+PII_YES = 'yes'
+PII_MAYBE = 'maybe'
 PII_IF_CUSTOMIZED = 'if_customized'
-KEY      = 0
-PII      = 1
+KEY = 0
+PII = 1
 MIN_SIZE = 2
 MAX_SIZE = 3
 MIN_TIME = 4
 MAX_TIME = 5
-MIME     = 6
-CHECKED  = 7
-HIDDEN   = 8
+MIME = 6
+CHECKED = 7
+HIDDEN = 8
 
 MIME_DATA = 'application/data'
 MIME_TEXT = 'text/plain'
@@ -191,20 +192,20 @@  CAP_XML_ROOT = "system-status-capabilities"
 CAP_XML_ELEMENT = 'capability'
 
 
-CAP_BOOT_LOADER          = 'boot-loader'
-CAP_DISK_INFO            = 'disk-info'
-CAP_HARDWARE_INFO        = 'hardware-info'
-CAP_KERNEL_INFO          = 'kernel-info'
-CAP_LOSETUP_A            = 'loopback-devices'
-CAP_MULTIPATH            = 'multipath'
-CAP_NETWORK_CONFIG       = 'network-config'
-CAP_NETWORK_INFO         = 'network-info'
-CAP_NETWORK_STATUS       = 'network-status'
-CAP_OPENVSWITCH_LOGS     = 'ovs-system-logs'
-CAP_PROCESS_LIST         = 'process-list'
-CAP_SYSTEM_LOGS          = 'system-logs'
-CAP_SYSTEM_SERVICES      = 'system-services'
-CAP_YUM                  = 'yum'
+CAP_BOOT_LOADER = 'boot-loader'
+CAP_DISK_INFO = 'disk-info'
+CAP_HARDWARE_INFO = 'hardware-info'
+CAP_KERNEL_INFO = 'kernel-info'
+CAP_LOSETUP_A = 'loopback-devices'
+CAP_MULTIPATH = 'multipath'
+CAP_NETWORK_CONFIG = 'network-config'
+CAP_NETWORK_INFO = 'network-info'
+CAP_NETWORK_STATUS = 'network-status'
+CAP_OPENVSWITCH_LOGS = 'ovs-system-logs'
+CAP_PROCESS_LIST = 'process-list'
+CAP_SYSTEM_LOGS = 'system-logs'
+CAP_SYSTEM_SERVICES = 'system-services'
+CAP_YUM = 'yum'
 
 KB = 1024
 MB = 1024 * 1024
@@ -218,6 +219,7 @@  log_days = 20
 log_last_mod_time = None
 free_disk_space = None
 
+
 def cap(key, pii=PII_MAYBE, min_size=-1, max_size=-1, min_time=-1,
         max_time=-1, mime=MIME_TEXT, checked=True, hidden=False):
     caps[key] = (key, pii, min_size, max_size, min_time, max_time, mime,
@@ -225,33 +227,20 @@  def cap(key, pii=PII_MAYBE, min_size=-1, max_size=-1, min_time=-1,
     cap_sizes[key] = 0
 
 
-cap(CAP_BOOT_LOADER,         PII_NO,                    max_size=3*KB,
-    max_time=5)
-cap(CAP_DISK_INFO,           PII_MAYBE,                 max_size=50*KB,
-    max_time=20)
-cap(CAP_HARDWARE_INFO,       PII_MAYBE,                 max_size=2*MB,
-    max_time=20)
-cap(CAP_KERNEL_INFO,         PII_MAYBE,                 max_size=120*KB,
-    max_time=5)
-cap(CAP_LOSETUP_A,           PII_MAYBE,                 max_size=KB, max_time=5)
-cap(CAP_MULTIPATH,           PII_MAYBE,                 max_size=20*KB,
-    max_time=10)
-cap(CAP_NETWORK_CONFIG,      PII_IF_CUSTOMIZED,
-                                        min_size=0,     max_size=5*MB)
-cap(CAP_NETWORK_INFO,        PII_YES,                   max_size=50*MB,
-    max_time=30)
-cap(CAP_NETWORK_STATUS,      PII_YES,                   max_size=-1,
-    max_time=30)
-cap(CAP_OPENVSWITCH_LOGS,    PII_MAYBE,                 max_size=-1,
-    max_time=5)
-cap(CAP_PROCESS_LIST,        PII_YES,                   max_size=30*KB,
-    max_time=20)
-cap(CAP_SYSTEM_LOGS,         PII_MAYBE,                 max_size=200*MB,
-    max_time=5)
-cap(CAP_SYSTEM_SERVICES,     PII_NO,                    max_size=5*KB,
-    max_time=20)
-cap(CAP_YUM,                 PII_IF_CUSTOMIZED,         max_size=10*KB,
-    max_time=30)
+cap(CAP_BOOT_LOADER, PII_NO, max_size=3 * KB, max_time=5)
+cap(CAP_DISK_INFO, PII_MAYBE, max_size=50 * KB, max_time=20)
+cap(CAP_HARDWARE_INFO, PII_MAYBE, max_size=2 * MB, max_time=20)
+cap(CAP_KERNEL_INFO, PII_MAYBE, max_size=120 * KB, max_time=5)
+cap(CAP_LOSETUP_A, PII_MAYBE, max_size=KB, max_time=5)
+cap(CAP_MULTIPATH, PII_MAYBE, max_size=20 * KB, max_time=10)
+cap(CAP_NETWORK_CONFIG, PII_IF_CUSTOMIZED, min_size=0, max_size=5 * MB)
+cap(CAP_NETWORK_INFO, PII_YES, max_size=50 * MB, max_time=30)
+cap(CAP_NETWORK_STATUS, PII_YES, max_size=-1, max_time=30)
+cap(CAP_OPENVSWITCH_LOGS, PII_MAYBE, max_size=-1, max_time=5)
+cap(CAP_PROCESS_LIST, PII_YES, max_size=30 * KB, max_time=20)
+cap(CAP_SYSTEM_LOGS, PII_MAYBE, max_size=200 * MB, max_time=5)
+cap(CAP_SYSTEM_SERVICES, PII_NO, max_size=5 * KB, max_time=20)
+cap(CAP_YUM, PII_IF_CUSTOMIZED, max_size=10 * KB, max_time=30)
 
 ANSWER_YES_TO_ALL = False
 SILENT_MODE = False
@@ -259,14 +248,17 @@  entries = None
 data = {}
 dev_null = open('/dev/null', 'r+')
 
+
 def output(x):
     global SILENT_MODE
     if not SILENT_MODE:
         print x
 
+
 def output_ts(x):
     output("[%s]  %s" % (time.strftime("%x %X %Z"), x))
 
+
 def cmd_output(cap, args, label=None, filter=None, binary=False):
     if cap in entries:
         if not label:
@@ -335,6 +327,7 @@  def func_output(cap, label, func):
         t = str(func).split()
         data[label] = {'cap': cap, 'func': func}
 
+
 def collect_data():
     process_lists = {}
 
@@ -441,7 +434,7 @@  Output options:
             return 0
 
         if k == '--output':
-            if  v in ['tar', 'tar.bz2', 'tar.gz', 'zip']:
+            if v in ['tar', 'tar.bz2', 'tar.gz', 'zip']:
                 output_type = v
             else:
                 print >>sys.stderr, "Invalid output format '%s'" % v
@@ -487,7 +480,6 @@  Output options:
         if k == '--log-days':
             log_days = int(v)
 
-
     if len(params) != 1:
         print >>sys.stderr, "Invalid additional arguments", str(params)
         return 2
@@ -506,7 +498,8 @@  Output options:
     log_last_mod_time = int(time.time()) - log_days * 86400
 
     if ANSWER_YES_TO_ALL:
-        output("Warning: '--yestoall' argument provided, will not prompt for individual files.")
+        output("Warning: '--yestoall' argument provided, will not prompt "
+               "for individual files.")
 
     output('''
 This application will collate dmesg output, details of the
@@ -526,7 +519,8 @@  exclude those logs from the archive.
 
     file_output(CAP_BOOT_LOADER, [GRUB_CONFIG])
     cmd_output(CAP_BOOT_LOADER, [LS, '-lR', '/boot'])
-    cmd_output(CAP_BOOT_LOADER, [MD5SUM, BOOT_KERNEL, BOOT_INITRD], label='vmlinuz-initrd.md5sum')
+    cmd_output(CAP_BOOT_LOADER, [MD5SUM, BOOT_KERNEL, BOOT_INITRD],
+               label='vmlinuz-initrd.md5sum')
 
     cmd_output(CAP_DISK_INFO, [FDISK, '-l'])
     file_output(CAP_DISK_INFO, [PROC_PARTITIONS, PROC_MOUNTS])
@@ -541,7 +535,8 @@  exclude those logs from the archive.
     cmd_output(CAP_DISK_INFO, [SG_MAP, '-x'])
     func_output(CAP_DISK_INFO, 'scsi-hosts', dump_scsi_hosts)
 
-    file_output(CAP_HARDWARE_INFO, [PROC_CPUINFO, PROC_MEMINFO, PROC_IOPORTS, PROC_INTERRUPTS])
+    file_output(CAP_HARDWARE_INFO,
+                [PROC_CPUINFO, PROC_MEMINFO, PROC_IOPORTS, PROC_INTERRUPTS])
     cmd_output(CAP_HARDWARE_INFO, [DMIDECODE])
     cmd_output(CAP_HARDWARE_INFO, [LSPCI, '-n'])
     cmd_output(CAP_HARDWARE_INFO, [LSPCI, '-vv'])
@@ -549,9 +544,8 @@  exclude those logs from the archive.
     file_output(CAP_HARDWARE_INFO, [SYSCONFIG_HWCONF])
     cmd_output(CAP_HARDWARE_INFO, [LS, '-lR', '/dev'])
 
-
-    file_output(CAP_KERNEL_INFO, [PROC_VERSION, PROC_MODULES, PROC_DEVICES,
-                                  PROC_FILESYSTEMS, PROC_CMDLINE])
+    file_output(CAP_KERNEL_INFO, [PROC_VERSION, PROC_MODULES,
+                PROC_DEVICES, PROC_FILESYSTEMS, PROC_CMDLINE])
     cmd_output(CAP_KERNEL_INFO, [ZCAT, PROC_CONFIG], label='config')
     cmd_output(CAP_KERNEL_INFO, [SYSCTL, '-A'])
     file_output(CAP_KERNEL_INFO, [MODPROBE_CONF])
@@ -569,8 +563,10 @@  exclude those logs from the archive.
 
     tree_output(CAP_NETWORK_CONFIG, SYSCONFIG_NETWORK_SCRIPTS, IFCFG_RE)
     tree_output(CAP_NETWORK_CONFIG, SYSCONFIG_NETWORK_SCRIPTS, ROUTE_RE)
-    file_output(CAP_NETWORK_CONFIG, [SYSCONFIG_NETWORK, RESOLV_CONF, NSSWITCH_CONF, HOSTS])
-    file_output(CAP_NETWORK_CONFIG, [NTP_CONF, IPTABLES_CONFIG, HOSTS_ALLOW, HOSTS_DENY])
+    file_output(CAP_NETWORK_CONFIG,
+                [SYSCONFIG_NETWORK, RESOLV_CONF, NSSWITCH_CONF, HOSTS])
+    file_output(CAP_NETWORK_CONFIG,
+                [NTP_CONF, IPTABLES_CONFIG, HOSTS_ALLOW, HOSTS_DENY])
     file_output(CAP_NETWORK_CONFIG, [OPENVSWITCH_DEFAULT_SWITCH,
                 OPENVSWITCH_SYSCONFIG_SWITCH])
 
@@ -611,22 +607,26 @@  exclude those logs from the archive.
         for d in dp_list():
             cmd_output(CAP_NETWORK_STATUS, [OVS_DPCTL, 'dump-flows', '-m', d])
 
-    cmd_output(CAP_PROCESS_LIST, [PS, 'wwwaxf', '-eo', 'pid,tty,stat,time,nice,psr,pcpu,pmem,nwchan,wchan:25,args'], label='process-tree')
+    cmd_output(CAP_PROCESS_LIST, [PS, 'wwwaxf', '-eo',
+               'pid,tty,stat,time,nice,psr,pcpu,pmem,nwchan,wchan:25,args'],
+               label='process-tree')
     func_output(CAP_PROCESS_LIST, 'fd_usage', fd_usage)
 
-    system_logs = ([ VAR_LOG_DIR + x for x in
+    system_logs = ([VAR_LOG_DIR + x for x in
         ['crit.log', 'kern.log', 'daemon.log', 'user.log',
         'syslog', 'messages', 'secure', 'debug', 'dmesg', 'boot']])
     for log in system_logs:
         prefix_output(CAP_SYSTEM_LOGS, log, last_mod_time=log_last_mod_time)
 
-    ovs_logs = ([ OPENVSWITCH_LOG_DIR + x for x in
+    ovs_logs = ([OPENVSWITCH_LOG_DIR + x for x in
         ['ovs-vswitchd.log', 'ovsdb-server.log',
         'ovs-xapi-sync.log', 'ovs-monitor-ipsec.log', 'ovs-ctl.log']])
     for log in ovs_logs:
-        prefix_output(CAP_OPENVSWITCH_LOGS, log, last_mod_time=log_last_mod_time)
+        prefix_output(CAP_OPENVSWITCH_LOGS, log,
+                      last_mod_time=log_last_mod_time)
 
-    if not os.path.exists('/var/log/dmesg') and not os.path.exists('/var/log/boot'):
+    if not os.path.exists('/var/log/dmesg') and \
+       not os.path.exists('/var/log/boot'):
         cmd_output(CAP_SYSTEM_LOGS, [DMESG])
 
     cmd_output(CAP_SYSTEM_SERVICES, [CHKCONFIG, '--list'])
@@ -638,7 +638,8 @@  exclude those logs from the archive.
     cmd_output(CAP_YUM, [RPM, '-qa'])
     file_output(CAP_YUM, [APT_SOURCES_LIST])
     tree_output(CAP_YUM, APT_SOURCES_LIST_D)
-    cmd_output(CAP_YUM, [DPKG_QUERY, '-W', '-f=${Package} ${Version} ${Status}\n'], 'dpkg-packages')
+    cmd_output(CAP_YUM, [DPKG_QUERY, '-W',
+               '-f=${Package} ${Version} ${Status}\n'], 'dpkg-packages')
 
     # Filter out ovs relevant information if --ovs option passed
     # else collect all information
@@ -671,13 +672,13 @@  exclude those logs from the archive.
     # permit the user to filter out data
     # We cannot use iteritems, since we modify 'data' as we pass through
     for (k, v) in sorted(data.items()):
-       cap = v['cap']
-       if 'filename' in v:
-           key = k[0]
-       else:
-           key = k
-       if not ANSWER_YES_TO_ALL and not yes("Include '%s'? [Y/n]: " % key):
-           del data[k]
+        cap = v['cap']
+        if 'filename' in v:
+            key = k[0]
+        else:
+            key = k
+        if not ANSWER_YES_TO_ALL and not yes("Include '%s'? [Y/n]: " % key):
+            del data[k]
 
     # collect selected data now
     output_ts('Running commands to collect data')
@@ -686,7 +687,8 @@  exclude those logs from the archive.
     subdir = "bug-report-%s" % time.strftime("%Y%m%d%H%M%S")
 
     # include inventory
-    data['inventory.xml'] = {'cap': None, 'output': StringIOmtime(make_inventory(data, subdir))}
+    data['inventory.xml'] = {'cap': None,
+                        'output': StringIOmtime(make_inventory(data, subdir))}
 
     # create archive
     if output_fd == -1:
@@ -717,6 +719,7 @@  exclude those logs from the archive.
     cleanup_ovsdb()
     return 0
 
+
 def dump_scsi_hosts(cap):
     output = ''
     l = os.listdir('/sys/class/scsi_host')
@@ -738,11 +741,13 @@  def dump_scsi_hosts(cap):
         except:
                 pass
 
-        output += "%s:\n" %h
-        output += "    %s%s\n" % (procname, modelname and (" -> %s" % modelname) or '')
+        output += "%s:\n" % h
+        output += "    %s%s\n" \
+                  % (procname, modelname and (" -> %s" % modelname) or '')
 
     return output
 
+
 def module_info(cap):
     output = StringIO.StringIO()
     modules = open(PROC_MODULES, 'r')
@@ -750,7 +755,8 @@  def module_info(cap):
 
     for line in modules:
         module = line.split()[0]
-        procs.append(ProcOutput([MODINFO, module], caps[cap][MAX_TIME], output))
+        procs.append(ProcOutput([MODINFO, module],
+                     caps[cap][MAX_TIME], output))
     modules.close()
 
     run_procs([procs])
@@ -765,9 +771,11 @@  def multipathd_topology(cap):
 
     return stdout
 
+
 def dp_list():
     output = StringIO.StringIO()
-    procs = [ProcOutput([OVS_DPCTL, 'dump-dps'], caps[CAP_NETWORK_STATUS][MAX_TIME], output)]
+    procs = [ProcOutput([OVS_DPCTL, 'dump-dps'],
+             caps[CAP_NETWORK_STATUS][MAX_TIME], output)]
 
     run_procs([procs])
 
@@ -775,11 +783,12 @@  def dp_list():
         return output.getvalue().splitlines()
     return []
 
+
 def collect_ovsdb():
     if not os.path.isfile(OPENVSWITCH_CONF_DB):
         return
 
-    max_size = 10*MB
+    max_size = 10 * MB
 
     try:
         if os.path.getsize(OPENVSWITCH_CONF_DB) > max_size:
@@ -798,6 +807,7 @@  def collect_ovsdb():
     except OSError, e:
         return
 
+
 def cleanup_ovsdb():
     try:
         if os.path.isfile(OPENVSWITCH_COMPACT_DB):
@@ -805,14 +815,15 @@  def cleanup_ovsdb():
     except:
         return
 
+
 def fd_usage(cap):
     output = ''
     fd_dict = {}
     for d in [p for p in os.listdir('/proc') if p.isdigit()]:
         try:
-            fh = open('/proc/'+d+'/cmdline')
+            fh = open('/proc/' + d + '/cmdline')
             name = fh.readline()
-            num_fds = len(os.listdir(os.path.join('/proc/'+d+'/fd')))
+            num_fds = len(os.listdir(os.path.join('/proc/' + d + '/fd')))
             if num_fds > 0:
                 if not num_fds in fd_dict:
                     fd_dict[num_fds] = []
@@ -825,6 +836,7 @@  def fd_usage(cap):
         output += "%s: %s\n" % (k, str(fd_dict[k]))
     return output
 
+
 def dump_rdac_groups(cap):
     output = StringIO.StringIO()
     procs = [ProcOutput([MPPUTIL, '-a'], caps[cap][MAX_TIME], output)]
@@ -842,8 +854,10 @@  def dump_rdac_groups(cap):
                 group, _ = line.split(None, 1)
                 cmd_output(cap, [MPPUTIL, '-g', group])
 
+
 def load_plugins(just_capabilities=False, filter=None):
     global log_last_mod_time
+
     def getText(nodelist):
         rc = ""
         for node in nodelist:
@@ -858,7 +872,8 @@  def load_plugins(just_capabilities=False, filter=None):
             ret = val in ['true', 'yes']
         return ret
 
-    for dir in [d for d in os.listdir(PLUGIN_DIR) if os.path.isdir(os.path.join(PLUGIN_DIR, d))]:
+    for dir in [d for d in os.listdir(PLUGIN_DIR)
+                if os.path.isdir(os.path.join(PLUGIN_DIR, d))]:
         if not caps.has_key(dir):
             if not os.path.exists("%s/%s.xml" % (PLUGIN_DIR, dir)):
                 continue
@@ -866,24 +881,29 @@  def load_plugins(just_capabilities=False, filter=None):
             assert xmldoc.documentElement.tagName == "capability"
 
             pii, min_size, max_size, min_time, max_time, mime = \
-                 PII_MAYBE, -1,-1,-1,-1, MIME_TEXT
+                 PII_MAYBE, -1, -1, -1, -1, MIME_TEXT
 
-            if xmldoc.documentElement.getAttribute("pii") in [PII_NO, PII_YES, PII_MAYBE, PII_IF_CUSTOMIZED]:
+            if xmldoc.documentElement.getAttribute("pii") in \
+               [PII_NO, PII_YES, PII_MAYBE, PII_IF_CUSTOMIZED]:
                 pii = xmldoc.documentElement.getAttribute("pii")
             if xmldoc.documentElement.getAttribute("min_size") != '':
-                min_size = long(xmldoc.documentElement.getAttribute("min_size"))
+                min_size = long(
+                            xmldoc.documentElement.getAttribute("min_size"))
             if xmldoc.documentElement.getAttribute("max_size") != '':
-                max_size = long(xmldoc.documentElement.getAttribute("max_size"))
+                max_size = long(
+                            xmldoc.documentElement.getAttribute("max_size"))
             if xmldoc.documentElement.getAttribute("min_time") != '':
                 min_time = int(xmldoc.documentElement.getAttribute("min_time"))
             if xmldoc.documentElement.getAttribute("max_time") != '':
                 max_time = int(xmldoc.documentElement.getAttribute("max_time"))
-            if xmldoc.documentElement.getAttribute("mime") in [MIME_DATA, MIME_TEXT]:
+            if xmldoc.documentElement.getAttribute("mime") in \
+               [MIME_DATA, MIME_TEXT]:
                 mime = xmldoc.documentElement.getAttribute("mime")
             checked = getBoolAttr(xmldoc.documentElement, 'checked', True)
             hidden = getBoolAttr(xmldoc.documentElement, 'hidden', False)
 
-            cap(dir, pii, min_size, max_size, min_time, max_time, mime, checked, hidden)
+            cap(dir, pii, min_size, max_size, min_time, max_time, mime,
+                checked, hidden)
 
         if just_capabilities:
             continue
@@ -912,7 +932,8 @@  def load_plugins(just_capabilities=False, filter=None):
                                     newest_first=newest_first)
                 elif el.tagName == "directory":
                     pattern = el.getAttribute("pattern")
-                    if pattern == '': pattern = None
+                    if pattern == '':
+                        pattern = None
                     negate = getBoolAttr(el, 'negate')
                     newest_first = getBoolAttr(el, 'newest_first')
                     if el.getAttribute("type") == "logs":
@@ -926,9 +947,12 @@  def load_plugins(just_capabilities=False, filter=None):
                                     negate=negate, newest_first=newest_first)
                 elif el.tagName == "command":
                     label = el.getAttribute("label")
-                    if label == '': label = None
+                    if label == '':
+                        label = None
                     binary = getBoolAttr(el, 'binary')
-                    cmd_output(dir, getText(el.childNodes), label, binary=binary)
+                    cmd_output(dir,
+                               getText(el.childNodes), label, binary=binary)
+
 
 def make_tar(subdir, suffix, output_fd, output_file):
     global SILENT_MODE, data
@@ -975,7 +999,7 @@  def make_tar(subdir, suffix, output_fd, output_file):
         tf.close()
 
     if output_fd == -1:
-        output ('Writing tarball %s successful.' % filename)
+        output('Writing tarball %s successful.' % filename)
         if SILENT_MODE:
             print filename
 
@@ -1009,7 +1033,7 @@  def make_zip(subdir, output_file):
     finally:
         zf.close()
 
-    output ('Writing archive %s successful.' % filename)
+    output('Writing archive %s successful.' % filename)
     if SILENT_MODE:
         print filename
 
@@ -1033,11 +1057,13 @@  def make_inventory(inventory, subdir):
         inventory.items())
     return document.toprettyxml()
 
+
 def inventory_entry(document, subdir, k, v):
     try:
         el = document.createElement(INVENTORY_XML_ELEMENT)
         el.setAttribute('capability', v['cap'])
-        el.setAttribute('filename', os.path.join(subdir, construct_filename(k, v)))
+        el.setAttribute('filename',
+                        os.path.join(subdir, construct_filename(k, v)))
         el.setAttribute('md5sum', md5sum(v))
         document.getElementsByTagName(INVENTORY_XML_ROOT)[0].appendChild(el)
     except:
@@ -1072,9 +1098,11 @@  def construct_filename(k, v):
 
     return s
 
+
 def update_capabilities():
     pass
 
+
 def update_cap_size(cap, size):
     update_cap(cap, MIN_SIZE, size)
     update_cap(cap, MAX_SIZE, size)
@@ -1117,9 +1145,11 @@  def size_of(f, pattern, negate):
 def print_capabilities():
     document = getDOMImplementation().createDocument(
         "ns", CAP_XML_ROOT, None)
-    map(lambda key: capability(document, key), [k for k in caps.keys() if not caps[k][HIDDEN]])
+    map(lambda key: capability(document, key),
+        [k for k in caps.keys() if not caps[k][HIDDEN]])
     print document.toprettyxml()
 
+
 def capability(document, key):
     c = caps[key]
     el = document.createElement(CAP_XML_ELEMENT)
@@ -1147,6 +1177,7 @@  def yes(prompt):
 
 partition_re = re.compile(r'(.*[0-9]+$)|(^xvd)')
 
+
 def disk_list():
     disks = []
     try:
@@ -1166,7 +1197,8 @@  def disk_list():
 class ProcOutput:
     debug = False
 
-    def __init__(self, command, max_time, inst=None, filter=None, binary=False):
+    def __init__(self, command, max_time, inst=None, filter=None,
+                 binary=False):
         self.command = command
         self.max_time = max_time
         self.inst = inst
@@ -1186,7 +1218,8 @@  class ProcOutput:
         self.terminate()
 
     def cmdAsStr(self):
-        return isinstance(self.command, list) and ' '.join(self.command) or self.command
+        return isinstance(self.command, list) \
+                and ' '.join(self.command) or self.command
 
     def run(self):
         self.timed_out = False
@@ -1197,7 +1230,8 @@  class ProcOutput:
                               stdin=dev_null, stdout=PIPE, stderr=dev_null,
                               shell=isinstance(self.command, str))
             old = fcntl.fcntl(self.proc.stdout.fileno(), fcntl.F_GETFD)
-            fcntl.fcntl(self.proc.stdout.fileno(), fcntl.F_SETFD, old | fcntl.FD_CLOEXEC)
+            fcntl.fcntl(self.proc.stdout.fileno(),
+                        fcntl.F_SETFD, old | fcntl.FD_CLOEXEC)
             self.running = True
             self.failed = False
         except:
@@ -1234,6 +1268,7 @@  class ProcOutput:
             if self.inst:
                 self.inst.write(line)
 
+
 def run_procs(procs):
     while True:
         pipes = []