]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
Fixes for syntax errors found by pyflakes.
authorSam Lang <sam.lang@inktank.com>
Thu, 31 Jan 2013 13:58:57 +0000 (07:58 -0600)
committerSam Lang <sam.lang@inktank.com>
Thu, 31 Jan 2013 13:58:57 +0000 (07:58 -0600)
This patch includes minor fixes to the teuthology
python code for syntax errors found by running
check-syntax.sh (which runs pyflakes on each file).

Signed-off-by: Sam Lang <sam.lang@inktank.com>
Reviewed-by: Josh Durgin <josh.durgin@inktank.com>
13 files changed:
teuthology/task/ceph-fuse.py
teuthology/task/ceph_manager.py
teuthology/task/exec.py
teuthology/task/hadoop.py
teuthology/task/kcon_most.py
teuthology/task/mds_thrash.py
teuthology/task/mpi.py
teuthology/task/nfs.py
teuthology/task/pexec.py
teuthology/task/recovery_bench.py
teuthology/task/rgw-logsocket.py
teuthology/task/ssh_keys.py
teuthology/task/workunit.py

index abcc964e5df2f4b611be6b45b4000fd35d932749..1eb0d78abefe604b562258468c59d242eedc3cbf 100644 (file)
@@ -135,7 +135,7 @@ def task(ctx, config):
                       mnt,
                       ],
                   )
-            except CommandFailedError as e:
+            except run.CommandFailedError:
               log.info('Failed to unmount ceph-fuse on {name}, aborting...'.format(name=remote.name))
               # abort the fuse mount, killing all hung processes
               remote.run(
index 1b96d1fac23b099a2594b3f3c1ad9498aa35df7d..22b84b13ca6d0638e53af1b3eb6385cc9283e068 100644 (file)
@@ -6,7 +6,6 @@ import gevent
 import json
 import threading
 from teuthology import misc as teuthology
-from ..orchestra import run
 
 class Thrasher:
     def __init__(self, manager, config, logger=None):
index 8961ee6faf5e0e4a3254ca5cc5787b7c8f553065..a914101e4021220dcca79784ff501d7225caeb55 100644 (file)
@@ -1,6 +1,4 @@
-import contextlib
 import logging
-import os
 
 from teuthology import misc as teuthology
 
index 38b88e460d843d8a1f4742788f05250d9e02a1db..034716c8f75ceebee14e12fe80c08333a2df21ad 100644 (file)
@@ -3,7 +3,6 @@ from cStringIO import StringIO
 import contextlib
 import logging
 import os
-import re
 
 from teuthology import misc as teuthology
 from teuthology import contextutil
@@ -298,7 +297,6 @@ def _download_hadoop_binaries(remote, hadoop_url):
 @contextlib.contextmanager
 def binaries(ctx, config):
     path = config.get('path')
-    tmpdir = None
 
     if path is None:
         # fetch from gitbuilder gitbuilder
index a831bfad7d4617d6c95554c827b98891ad8af649..5836f2faa9ca417dc599053d78c7cb34b38534e6 100644 (file)
@@ -1,6 +1,5 @@
 import contextlib
 import logging
-import os
 
 from teuthology import misc as teuthology
 
index d143b4f7a9722dfe754f66a99d3034bb49575b59..d37651d4a2e2286bb92fe3b2344fdc5fc09559f8 100644 (file)
@@ -119,7 +119,7 @@ class MDSThrasher:
 
       skip = random.randrange(0.0, 1.0)
       if self.weight < 1.0 and skip > self.weight:
-          self.log('skipping thrash iteration with skip ({skip}) > weight ({weight})'.format(skip=skip, weight=weight))
+          self.log('skipping thrash iteration with skip ({skip}) > weight ({weight})'.format(skip=skip, weight=self.weight))
           continue
 
       # find the active mds in the failure group
@@ -239,7 +239,6 @@ def task(ctx, config):
   random.seed(seed)
 
   max_thrashers = config.get('max_thrash', 1)
-  managers = {}
   thrashers = {}
 
   (first,) = ctx.cluster.only('mds.{_id}'.format(_id=mdslist[0])).remotes.iterkeys()
index c5a13745b3fa359839a1aa518f6027839e79ce62..67d444f935a1d22523270b42a27b4f30407ce4fa 100644 (file)
@@ -1,7 +1,4 @@
-import contextlib
 import logging
-import os
-from datetime import datetime
 
 from teuthology import misc as teuthology
 
@@ -94,7 +91,6 @@ def task(ctx, config):
 
     # write out the mpi hosts file
     log.info('mpi nodes: [%s]' % (', '.join(hosts)))
-    hostfiledata = '\n'.join(hosts) + '\n'
     teuthology.write_file(remote=master_remote, path='/tmp/cephtest/mpi-hosts', data='\n'.join(hosts))
     log.info('mpiexec on {name}: {cmd}'.format(name=master_remote.name, cmd=mpiexec))
     args=['mpiexec', '-f', '/tmp/cephtest/mpi-hosts']
index b2864a11c82e57b3f246032168a65c618f10858d..ed92f5f88ff9b478fe0547b504d7ef85c6c20fcf 100644 (file)
@@ -1,7 +1,6 @@
 import contextlib
 import logging
 import os
-import re
 
 from teuthology import misc as teuthology
 
index 5e7b7be1986f28eca293222aae1c133981fb6886..de0fb519c03474cbfce5f4422ceab2071f1f4ab2 100644 (file)
@@ -1,7 +1,4 @@
-import contextlib
 import logging
-import os
-from datetime import datetime
 
 from teuthology import misc as teuthology
 from teuthology.parallel import parallel
index 72b40c302b5bbb435bc19310724eef8fb5e283a6..ea4fb765ee3a1d43ca4ecc104b7d48b1b098becc 100644 (file)
@@ -170,7 +170,7 @@ class RecoveryBencher:
                 sample = json.loads(line)
                 samples = lat.setdefault(sample['type'], [])
                 samples.append(float(sample['latency']))
-            except Exception, e:
+            except Exception:
               pass
 
         for type in lat:
index daa29c18cb3c0219c48b50581dd5ae12c924a4b0..0f6b1c7f0ab83b473483c89cd99b5a832ccfbbad 100644 (file)
@@ -1,18 +1,11 @@
 from cStringIO import StringIO
 from configobj import ConfigObj
-import base64
 import contextlib
 import logging
-import os
-import random
-import string
 import s3tests
-import socket
 
 from teuthology import misc as teuthology
 from teuthology import contextutil
-from ..orchestra import run
-from ..orchestra.connection import split_user
 
 log = logging.getLogger(__name__)
 
@@ -60,7 +53,7 @@ def run_tests(ctx, config):
     netcat_out = StringIO()
 
     for client, client_config in config.iteritems():
-        proc = ctx.cluster.only(client).run(
+        ctx.cluster.only(client).run(
             args = [
                 'netcat',
                 '-w', '5',
index bb7ce8493d4fa9c993a54e15a55669833171351f..c2637d01eab44b7ff475ef32439987c4e4e9c77d 100644 (file)
@@ -1,8 +1,6 @@
 #!/usr/bin/python
 import contextlib
-import errno
 import logging
-import os
 import paramiko
 import re
 
@@ -62,7 +60,6 @@ def cleanup_keys(ctx, public_key):
         # fails 1/2 way through (don't want to break ssh on the vm)
         old_auth_keys_file = mySftp.open(auth_keys_file)
         new_auth_keys_file = mySftp.open(auth_keys_file + '.new', 'w')
-        out_keys = []
 
         for line in old_auth_keys_file.readlines():
             match = re.search(re.escape(public_key), line)
index 5e49b3b8aa603697a091ce289ffeed862b70171e..aae28eeaa6002ad1e5caedf5cbd0e1157d4c86ed 100644 (file)
@@ -144,7 +144,7 @@ def _make_scratch_dir(ctx, role, subdir):
     # if neither kclient nor ceph-fuse are required for a workunit,
     # mnt may not exist. Stat and create the directory if it doesn't.
     try:
-        proc = remote.run(
+        remote.run(
             args=[
                 'stat',
                 '--',
@@ -153,7 +153,7 @@ def _make_scratch_dir(ctx, role, subdir):
             )
         log.info('Did not need to create dir {dir}'.format(dir=mnt))
     except:
-        proc = remote.run(
+        remote.run(
             args=[
                 'mkdir',
                 '--',