]> git-server-git.apps.pok.os.sepia.ceph.com Git - teuthology.git/commitdiff
Never use 'except:' without specifying an Exception. 63/head
authorZack Cerza <zack@cerza.org>
Fri, 30 Aug 2013 15:58:10 +0000 (10:58 -0500)
committerZack Cerza <zack@cerza.org>
Fri, 30 Aug 2013 16:10:05 +0000 (11:10 -0500)
18 files changed:
teuthology/contextutil.py
teuthology/coverage.py
teuthology/locker/api.py
teuthology/misc.py
teuthology/nuke.py
teuthology/parallel.py
teuthology/suite.py
teuthology/task/ceph.py
teuthology/task/ceph_manager.py
teuthology/task/cifs-mount.py
teuthology/task/dump_stuck.py
teuthology/task/install.py
teuthology/task/internal.py
teuthology/task/kernel.py
teuthology/task/mon_thrash.py
teuthology/task/radosgw-admin.py
teuthology/task/samba.py
teuthology/task/workunit.py

index 690d07f951099a81f7ddeb03c7e3b3f969faee96..bfcb830ae04b7127a4953388c4775d240bb2121f 100644 (file)
@@ -25,7 +25,7 @@ def nested(*managers):
             vars.append(enter())
             exits.append(exit)
         yield vars
-    except:
+    except Exception:
         log.exception('Saw exception from nested tasks')
         exc = sys.exc_info()
     finally:
@@ -34,7 +34,7 @@ def nested(*managers):
             try:
                 if exit(*exc):
                     exc = (None, None, None)
-            except:
+            except Exception:
                 exc = sys.exc_info()
         if exc != (None, None, None):
             # Don't rely on sys.exc_info() still containing
index 8a31b439a277974ad54e807ab57a7fa086edbc19..2a6c2aea45ef390c559bde2e66af1bd77fcf0786 100644 (file)
@@ -56,7 +56,7 @@ def store_coverage(ctx, test_coverage, rev, suite):
                 ' `function_cov`, `branches`, `branch_cov`)'
                 ' VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s)',
                 rows)
-        except:
+        except Exception:
             log.exception('error updating database')
             db.rollback()
             raise
@@ -143,7 +143,7 @@ Analyze the coverage of a suite of test runs, generating html output with lcov.
 
     try:
         _analyze(args)
-    except:
+    except Exception:
         log.exception('error generating coverage')
         raise
 
index 2203fd5e3ea84a02c98912fce32a9c4c35146aba..91b0e5effa7d88397cb4325e644fd36e5a4c4585 100644 (file)
@@ -182,7 +182,8 @@ class Lock:
                                            description=desc,
                                            locked_since=web.db.SQLLiteral('NOW()'))
                     assert num_locked == num, 'Failed to lock machines'
-            except:
+            except Exception:
+                log.exception("Saw exception")
                 tries += 1
                 if tries < 10:
                     continue
index 337d0115f8e0b939157da84c35b1ae43ad296d4c..7be8fb271a8feefa272a4a316f069ac72368aab7 100644 (file)
@@ -580,7 +580,7 @@ def get_wwn_id_map(remote, devs):
             stdout=StringIO(),
             )
         stdout = r.stdout.getvalue()
-    except:
+    except Exception:
         log.error('Failed to get wwn devices! Using /dev/sd* devices...')
         return dict((d,d) for d in devs)
 
@@ -613,7 +613,7 @@ def get_scratch_devices(remote):
     try:
         file_data = get_file(remote, "/scratch_devs")
         devs = file_data.split()
-    except:
+    except Exception:
         r = remote.run(
                 args=['ls', run.Raw('/dev/[sv]d?')],
                 stdout=StringIO()
@@ -648,7 +648,8 @@ def get_scratch_devices(remote):
                     ]
                 )
             retval.append(dev)
-        except:
+        except Exception:
+            log.exception("Saw exception")
             pass
     return retval
 
index 4aa1fc791d456206311fbfe564d672f3ec09c984..319b1f2dcea3b567cddf3c41fc2f11b704c27bd0 100644 (file)
@@ -99,7 +99,7 @@ def shutdown_daemons(ctx, log):
             wait=False,
             )
         nodes[remote.name] = proc
-    
+
     for name, proc in nodes.iteritems():
         log.info('Waiting for %s to finish shutdowns...', name)
         proc.exitstatus.get()
@@ -126,13 +126,13 @@ def find_kernel_mounts(ctx, log):
             kernel_mounts.append(remote)
         except run.CommandFailedError: # no mounts!
             log.debug('no kernel mount on %s', remote.name)
-    
+
     return kernel_mounts
 
 def remove_kernel_mounts(ctx, kernel_mounts, log):
     """
     properly we should be able to just do a forced unmount,
-    but that doesn't seem to be working, so you should reboot instead 
+    but that doesn't seem to be working, so you should reboot instead
     """
     from .orchestra import run
     nodes = {}
@@ -397,8 +397,8 @@ def nuke_one(ctx, targets, log, should_unlock, synch_clocks, reboot_all,
         )
     try:
         nuke_helper(ctx, log)
-    except:
-        log.exception('Could not nuke all targets in %s', targets)
+    except Exception:
+        log.exception('Could not nuke all targets in %s' % targets)
         # not re-raising the so that parallel calls aren't killed
         ret = targets
     else:
index dbc69ba42a48313c5953b3a1786d04751963a4f7..17312e54b3ea074dab701265efaabd107d94c8df 100644 (file)
@@ -83,7 +83,7 @@ class parallel(object):
             for result in self:
                 log.debug('result is %s', repr(result))
                 pass
-        except:
+        except Exception:
             self.group.kill(block=True)
             raise
         return True
index 40bf2d904cf2c7d652cde582719eb435940b4973..04c5da2c7e072cb8853cb28594dd8ee9d90a3524 100644 (file)
@@ -405,7 +405,7 @@ def results():
 
     try:
         _results(args)
-    except:
+    except Exception:
         log.exception('error generating results')
         raise
 
index 4db72943ff06b128f2045f3be95324d5461a0220..b571cb668b1d8e95aa48760e41f45ea47d930845 100644 (file)
@@ -229,7 +229,7 @@ def valgrind_post(ctx, config):
                     continue
                 try:
                     (file, kind) = line.split(':')
-                except:
+                except Exception:
                     log.error('failed to split line %s', line)
                     raise
                 log.debug('file %s kind %s', file, kind)
@@ -722,7 +722,7 @@ def cluster(ctx, config):
 
     try:
         yield
-    except:
+    except Exception:
         # we need to know this below
         ctx.summary['success'] = False
         raise
index cff36ede3bf0e20003e61aa481f3a4e700ec3309..9cf68a2474ca50dc2e242f9988604f8257a7eaec 100644 (file)
@@ -41,7 +41,7 @@ class Thrasher:
         try:
             manager.raw_cluster_cmd('--', 'tell', 'mon.*', 'injectargs',
                                     '--mon-osd-down-out-interval 0')
-        except:
+        except Exception:
             manager.raw_cluster_cmd('--', 'mon', 'tell', '*', 'injectargs',
                                     '--mon-osd-down-out-interval 0')
         self.thread = gevent.spawn(self.do_thrash)
index ecd61eb440f951e3e514db596e2efb951f8e4896..179738d1fea8a714dcdae264477dd75dbeb0f09a 100644 (file)
@@ -127,5 +127,5 @@ def task(ctx, config):
                         )
                     import time
                     time.sleep(1)
-                except:
+                except Exception:
                     break
index e7f5c7e3c1890d987d93b997a043656448dde472..f86feb41806b3c129f776b0a803109d17edd9305 100644 (file)
@@ -117,8 +117,8 @@ def task(ctx, config):
             manager.raw_cluster_cmd('tell', 'osd.0', 'flush_pg_stats')
             manager.raw_cluster_cmd('tell', 'osd.1', 'flush_pg_stats')
             break
-        except:
-            log.debug('osds must not be started yet, waiting...')
+        except Exception:
+            log.exception('osds must not be started yet, waiting...')
             time.sleep(1)
     manager.wait_for_clean(timeout)
 
index bc01705edccf8021e21e83aacaf115ac9ebf1fb7..5653db4b367b9b075bde9d02dcb4b4fd420f5383 100644 (file)
@@ -294,7 +294,7 @@ def _update_rpm_package_list_and_install(ctx, remote, rpm, config):
         # fail with the message 'rpm: no packages given for install'
         remote.run(args=['wget', base_url, ],)
         remote.run(args=['sudo', 'rpm', '-i', rpm_name, ], stderr=err_mess, )
-    except:
+    except Exception:
         cmp_msg = 'package {pkg} is already installed'.format(
             pkg=ceph_release)
         if cmp_msg != err_mess.getvalue().strip():
index 45dad5d2e1e82eb596e4985358a019adcba7133a..b1bff231532aa0000caaddc2a021fbf187ae3a38 100644 (file)
@@ -295,7 +295,7 @@ def archive(ctx, config):
 
     try:
         yield
-    except:
+    except Exception:
         # we need to know this below
         ctx.summary['success'] = False
         raise
index a5ef4ae748947e88e55ae4d119d8ddedd920d905..66723056655d25aeb543ec23c9be6b502ff69a6a 100644 (file)
@@ -164,10 +164,10 @@ def install_firmware(ctx, config):
             )
         role_remote.run(
             args=[
-                'sudo', 'git', '--git-dir=%s/.git' % fw_dir, 'config',           
+                'sudo', 'git', '--git-dir=%s/.git' % fw_dir, 'config',
                 '--get', 'remote.origin.url', run.Raw('>/dev/null'),
                 run.Raw('||'),
-                'sudo', 'git', '--git-dir=%s/.git' % fw_dir,           
+                'sudo', 'git', '--git-dir=%s/.git' % fw_dir,
                 'remote', 'add', 'origin', uri,
                 ],
             )
@@ -239,12 +239,12 @@ def download_deb(ctx, config):
 
 def _no_grub_link(in_file, remote, kernel_ver):
     boot1 = '/boot/%s' % in_file
-    boot2 = '%s.old' % boot1 
+    boot2 = '%s.old' % boot1
     remote.run(
         args=[
             'if', 'test', '-e', boot1, run.Raw(';'), 'then',
             'sudo', 'mv', boot1, boot2, run.Raw(';'), 'fi',],
-    ) 
+    )
     remote.run(
         args=['sudo', 'ln', '-s', '%s-%s' % (in_file, kernel_ver) , boot1, ],
     )
@@ -312,7 +312,7 @@ def install_and_reboot(ctx, config):
         # kernel entry appears later in the file than a submenu entry,
         # it's actually nested under that submenu.  If it gets more
         # complex this will totally break.
-        
+
         cmdout = StringIO()
         proc = role_remote.run(
             args=[
@@ -427,7 +427,8 @@ def wait_for_reboot(ctx, need_install, timeout):
                 assert not need_to_install(ctx, client, need_install[client]), \
                         'failed to install new kernel version within timeout'
                 del need_install[client]
-            except:
+            except Exception:
+                log.exception("Saw exception")
                 # ignore connection resets and asserts while time is left
                 if time.time() - starttime > timeout:
                     raise
index 2035bf1e332b851b3c31e8b3c1e0490b45a2d003..fff73d81e867abec530034269c3e506ec7e4fe95 100644 (file)
@@ -258,7 +258,7 @@ class MonitorThrasher:
         self.log('triggering scrub')
         try:
           self.manager.raw_cluster_cmd('scrub')
-        except:
+        except Exception:
           pass
 
       if self.thrash_delay > 0.0:
index fb29b546be95c28c146d676215c7e5251f0357aa..b1b6cdbf4e520e58f28be728c9ff4680c6a1e8cf 100644 (file)
@@ -53,7 +53,7 @@ def task(ctx, config):
     if multi_region_run:
         client = rgw_utils.get_master_client(ctx, clients)
 
-    # once the client is chosen, pull the host name and  assigned port out of 
+    # once the client is chosen, pull the host name and  assigned port out of
     # the role_endpoints that were assigned by the rgw task
     (remote_host, remote_port) = ctx.rgw.role_endpoints[client]
 
@@ -146,17 +146,17 @@ def task(ctx, config):
             assert out['keys'][0]['access_key'] == access_key
             assert out['keys'][0]['secret_key'] == secret_key
             assert not out['suspended']
-    
+
         # compare the metadata between different regions, make sure it matches
         for agent_client, c_config in ctx.radosgw_agent.config.iteritems():
             source_client = c_config['src']
             dest_client = c_config['dest']
-            (err1, out1) = rgwadmin(ctx, source_client, 
+            (err1, out1) = rgwadmin(ctx, source_client,
                 ['metadata', 'get', 'user:{uid}'.format(uid=user1)], check_status=True)
-            (err2, out2) = rgwadmin(ctx, dest_client, 
+            (err2, out2) = rgwadmin(ctx, dest_client,
                 ['metadata', 'get', 'user:{uid}'.format(uid=user1)], check_status=True)
             assert out1 == out2
-    
+
         # suspend a user on the master, then check the status on the destination
         for agent_client, c_config in ctx.radosgw_agent.config.iteritems():
             source_client = c_config['src']
@@ -165,7 +165,7 @@ def task(ctx, config):
             rgw_utils.radosgw_agent_sync_all(ctx)
             (err, out) = rgwadmin(ctx, dest_client, ['user', 'info', '--uid', user1], check_status=True)
             assert out['suspended']
-    
+
         # delete a user on the master, then check that it's gone on the destination
         for agent_client, c_config in ctx.radosgw_agent.config.iteritems():
             source_client = c_config['src']
@@ -176,7 +176,7 @@ def task(ctx, config):
             assert out is None
             (err, out) = rgwadmin(ctx, dest_client, ['user', 'info', '--uid', user1])
             assert out is None
-    
+
             # then recreate it so later tests pass
             (err, out) = rgwadmin(ctx, client, [
                 'user', 'create',
@@ -213,10 +213,10 @@ def task(ctx, config):
         for agent_client, c_config in ctx.radosgw_agent.config.iteritems():
             source_client = c_config['src']
             dest_client = c_config['dest']
-            (err1, out1) = rgwadmin(ctx, source_client, 
+            (err1, out1) = rgwadmin(ctx, source_client,
                 ['metadata', 'get', 'bucket:{bucket_name}'.format(bucket_name=bucket_name2)],
                 check_status=True)
-            (err2, out2) = rgwadmin(ctx, dest_client, 
+            (err2, out2) = rgwadmin(ctx, dest_client,
                 ['metadata', 'get', 'bucket:{bucket_name}'.format(bucket_name=bucket_name2)],
                 check_status=True)
             assert out1 == out2
@@ -224,16 +224,16 @@ def task(ctx, config):
             # get the bucket.instance info and compare that
             src_bucket_id = out1['data']['bucket']['bucket_id']
             dest_bucket_id = out2['data']['bucket']['bucket_id']
-            (err1, out1) = rgwadmin(ctx, source_client, ['metadata', 'get', 
+            (err1, out1) = rgwadmin(ctx, source_client, ['metadata', 'get',
                 'bucket.instance:{bucket_name}:{bucket_instance}'.format(
                 bucket_name=bucket_name2,bucket_instance=src_bucket_id)],
                 check_status=True)
-            (err2, out2) = rgwadmin(ctx, dest_client, ['metadata', 'get', 
+            (err2, out2) = rgwadmin(ctx, dest_client, ['metadata', 'get',
                 'bucket.instance:{bucket_name}:{bucket_instance}'.format(
                 bucket_name=bucket_name2,bucket_instance=dest_bucket_id)],
                 check_status=True)
             assert out1 == out2
-    
+
         for agent_client, c_config in ctx.radosgw_agent.config.iteritems():
             source_client = c_config['src']
             dest_client = c_config['dest']
@@ -269,13 +269,13 @@ def task(ctx, config):
         for agent_client, c_config in ctx.radosgw_agent.config.iteritems():
             source_client = c_config['src']
             dest_client = c_config['dest']
-            (err1, out1) = rgwadmin(ctx, source_client, ['metadata', 'get', 
+            (err1, out1) = rgwadmin(ctx, source_client, ['metadata', 'get',
                 'bucket:{bucket_name}'.format(bucket_name=bucket_name2)])
-            (err2, out2) = rgwadmin(ctx, dest_client, ['metadata', 'get', 
+            (err2, out2) = rgwadmin(ctx, dest_client, ['metadata', 'get',
                 'bucket:{bucket_name}'.format(bucket_name=bucket_name2)])
-            # Both of the previous calls should have errors due to requesting 
+            # Both of the previous calls should have errors due to requesting
             # metadata for non-existent buckets
-            assert err1 
+            assert err1
             assert err2
 
         # create a bucket and then sync it
@@ -286,15 +286,15 @@ def task(ctx, config):
         for agent_client, c_config in ctx.radosgw_agent.config.iteritems():
             source_client = c_config['src']
             dest_client = c_config['dest']
-            (err1, out1) = rgwadmin(ctx, source_client, 
+            (err1, out1) = rgwadmin(ctx, source_client,
                 ['metadata', 'get', 'bucket:{bucket_name}'.format(bucket_name=bucket_name2)],
                 check_status=True)
-            (err2, out2) = rgwadmin(ctx, dest_client, 
+            (err2, out2) = rgwadmin(ctx, dest_client,
                 ['metadata', 'get', 'bucket:{bucket_name}'.format(bucket_name=bucket_name2)],
                 check_status=True)
             assert out1 == out2
 
-        # Now delete the bucket and recreate it with a different user 
+        # Now delete the bucket and recreate it with a different user
         # within the same window of time and then sync.
         bucket.delete()
         bucket = connection2.create_bucket(bucket_name2)
@@ -305,10 +305,10 @@ def task(ctx, config):
         for agent_client, c_config in ctx.radosgw_agent.config.iteritems():
             source_client = c_config['src']
             dest_client = c_config['dest']
-            (err1, out1) = rgwadmin(ctx, source_client, 
+            (err1, out1) = rgwadmin(ctx, source_client,
                 ['metadata', 'get', 'bucket:{bucket_name}'.format(bucket_name=bucket_name2)],
                 check_status=True)
-            (err2, out2) = rgwadmin(ctx, dest_client, 
+            (err2, out2) = rgwadmin(ctx, dest_client,
                 ['metadata', 'get', 'bucket:{bucket_name}'.format(bucket_name=bucket_name2)],
                 check_status=True)
             assert out1 == out2
@@ -321,7 +321,7 @@ def task(ctx, config):
             dest_client = c_config['dest']
 
             # get the metadata so we can tweak it
-            (err, orig_data) = rgwadmin(ctx, source_client, 
+            (err, orig_data) = rgwadmin(ctx, source_client,
                 ['metadata', 'get', 'bucket:{bucket_name}'.format(bucket_name=bucket_name2)],
                 check_status=True)
 
@@ -329,26 +329,26 @@ def task(ctx, config):
             new_data = copy.deepcopy(orig_data)
             new_data['mtime'] =  orig_data['mtime'] - 300
             assert new_data != orig_data
-            (err, out) = rgwadmin(ctx, source_client, 
-                ['metadata', 'put', 'bucket:{bucket_name}'.format(bucket_name=bucket_name2)], 
+            (err, out) = rgwadmin(ctx, source_client,
+                ['metadata', 'put', 'bucket:{bucket_name}'.format(bucket_name=bucket_name2)],
                 stdin=StringIO(json.dumps(new_data)),
                 check_status=True)
 
             # get the metadata and make sure that the 'put' worked
-            (err, out) = rgwadmin(ctx, source_client, 
+            (err, out) = rgwadmin(ctx, source_client,
                 ['metadata', 'get', 'bucket:{bucket_name}'.format(bucket_name=bucket_name2)],
                 check_status=True)
             assert out == new_data
 
-            # sync to propagate the new metadata 
+            # sync to propagate the new metadata
             rgw_utils.radosgw_agent_sync_all(ctx)
 
             # get the metadata from the dest and compare it to what we just set
-            # and what the source region has. 
-            (err1, out1) = rgwadmin(ctx, source_client, 
+            # and what the source region has.
+            (err1, out1) = rgwadmin(ctx, source_client,
                 ['metadata', 'get', 'bucket:{bucket_name}'.format(bucket_name=bucket_name2)],
                 check_status=True)
-            (err2, out2) = rgwadmin(ctx, dest_client, 
+            (err2, out2) = rgwadmin(ctx, dest_client,
                 ['metadata', 'get', 'bucket:{bucket_name}'.format(bucket_name=bucket_name2)],
                 check_status=True)
             # yeah for the transitive property
@@ -358,15 +358,15 @@ def task(ctx, config):
         # now we delete the bucket
         bucket.delete()
 
-        # Delete user2 as later tests do not expect it to exist. 
+        # Delete user2 as later tests do not expect it to exist.
         # Verify that it is gone on both regions
         for agent_client, c_config in ctx.radosgw_agent.config.iteritems():
             source_client = c_config['src']
             dest_client = c_config['dest']
-            (err, out) = rgwadmin(ctx, source_client, 
+            (err, out) = rgwadmin(ctx, source_client,
                 ['user', 'rm', '--uid', user2], check_status=True)
             rgw_utils.radosgw_agent_sync_all(ctx)
-            # The two 'user info' calls should fail and not return any data 
+            # The two 'user info' calls should fail and not return any data
             # since we just deleted this user.
             (err, out) = rgwadmin(ctx, source_client, ['user', 'info', '--uid', user2])
             assert out is None
@@ -376,7 +376,7 @@ def task(ctx, config):
     # end of 'if multi_region_run:'
 
     # TESTCASE 'suspend-ok','user','suspend','active user','succeeds'
-    (err, out) = rgwadmin(ctx, client, ['user', 'suspend', '--uid', user1], 
+    (err, out) = rgwadmin(ctx, client, ['user', 'suspend', '--uid', user1],
         check_status=True)
 
     # TESTCASE 'suspend-suspended','user','suspend','suspended user','succeeds w/advisory'
@@ -397,7 +397,7 @@ def task(ctx, config):
             ], check_status=True)
 
     # TESTCASE 'info-new-key','user','info','after key addition','returns all keys'
-    (err, out) = rgwadmin(ctx, client, ['user', 'info', '--uid', user1], 
+    (err, out) = rgwadmin(ctx, client, ['user', 'info', '--uid', user1],
         check_status=True)
     assert len(out['keys']) == 2
     assert out['keys'][0]['access_key'] == access_key2 or out['keys'][1]['access_key'] == access_key2
@@ -474,7 +474,7 @@ def task(ctx, config):
     assert len(out['subusers']) == 0
 
     # TESTCASE 'bucket-stats','bucket','stats','no session/buckets','succeeds, empty list'
-    (err, out) = rgwadmin(ctx, client, ['bucket', 'stats', '--uid', user1], 
+    (err, out) = rgwadmin(ctx, client, ['bucket', 'stats', '--uid', user1],
         check_status=True)
     assert len(out) == 0
 
@@ -506,7 +506,7 @@ def task(ctx, config):
     failed = False
     try:
         connection.create_bucket(bucket_name + '5')
-    except:
+    except Exception:
         failed = True
     assert failed
 
@@ -514,7 +514,7 @@ def task(ctx, config):
     bucket2.delete()
     bucket3.delete()
     bucket4.delete()
-   
+
     # TESTCASE 'bucket-stats3','bucket','stats','new empty bucket','succeeds, empty list'
     (err, out) = rgwadmin(ctx, client, [
             'bucket', 'stats', '--bucket', bucket_name], check_status=True)
@@ -541,8 +541,8 @@ def task(ctx, config):
     key.delete()
 
     # TESTCASE 'bucket unlink', 'bucket', 'unlink', 'unlink bucket from user', 'fails', 'access denied error'
-    (err, out) = rgwadmin(ctx, client, 
-        ['bucket', 'unlink', '--uid', user1, '--bucket', bucket_name], 
+    (err, out) = rgwadmin(ctx, client,
+        ['bucket', 'unlink', '--uid', user1, '--bucket', bucket_name],
         check_status=True)
 
     # create a second user to link the bucket to
@@ -553,7 +553,7 @@ def task(ctx, config):
             '--access-key', access_key2,
             '--secret', secret_key2,
             '--max-buckets', '1',
-            ], 
+            ],
             check_status=True)
 
     # try creating an object with the first user before the bucket is relinked
@@ -583,7 +583,7 @@ def task(ctx, config):
         check_status=True)
 
     # relink the bucket to the first user and delete the second user
-    (err, out) = rgwadmin(ctx, client, 
+    (err, out) = rgwadmin(ctx, client,
         ['bucket', 'link', '--uid', user1, '--bucket', bucket_name],
         check_status=True)
 
@@ -598,7 +598,7 @@ def task(ctx, config):
     key.set_contents_from_string(object_name)
 
     # now delete it
-    (err, out) = rgwadmin(ctx, client, 
+    (err, out) = rgwadmin(ctx, client,
         ['object', 'rm', '--bucket', bucket_name, '--object', object_name],
         check_status=True)
 
@@ -625,7 +625,7 @@ def task(ctx, config):
 
         # exempt bucket_name2 from checking as it was only used for multi-region tests
         assert log['bucket'].find(bucket_name) == 0 or log['bucket'].find(bucket_name2) == 0
-        assert log['bucket'] != bucket_name or log['bucket_id'] == bucket_id 
+        assert log['bucket'] != bucket_name or log['bucket_id'] == bucket_id
         assert log['bucket_owner'] == user1 or log['bucket'] == bucket_name + '5' or log['bucket'] == bucket_name2
         for entry in log['log_entries']:
             assert entry['bucket'] == log['bucket']
@@ -656,7 +656,7 @@ def task(ctx, config):
     assert total['successful_ops'] > 0
 
     # TESTCASE 'usage-show2' 'usage' 'show' 'user usage' 'succeeds'
-    (err, out) = rgwadmin(ctx, client, ['usage', 'show', '--uid', user1], 
+    (err, out) = rgwadmin(ctx, client, ['usage', 'show', '--uid', user1],
         check_status=True)
     assert len(out['entries']) > 0
     assert len(out['summary']) > 0
@@ -679,7 +679,7 @@ def task(ctx, config):
         assert entry['successful_ops'] > 0
 
     # TESTCASE 'usage-trim' 'usage' 'trim' 'user usage' 'succeeds, usage removed'
-    (err, out) = rgwadmin(ctx, client, ['usage', 'trim', '--uid', user1], 
+    (err, out) = rgwadmin(ctx, client, ['usage', 'trim', '--uid', user1],
         check_status=True)
     (err, out) = rgwadmin(ctx, client, ['usage', 'show', '--uid', user1],
         check_status=True)
@@ -687,7 +687,7 @@ def task(ctx, config):
     assert len(out['summary']) == 0
 
     # TESTCASE 'user-suspend2','user','suspend','existing user','succeeds'
-    (err, out) = rgwadmin(ctx, client, ['user', 'suspend', '--uid', user1], 
+    (err, out) = rgwadmin(ctx, client, ['user', 'suspend', '--uid', user1],
         check_status=True)
 
     # TESTCASE 'user-suspend3','user','suspend','suspended user','cannot write objects'
@@ -698,7 +698,7 @@ def task(ctx, config):
         assert e.status == 403
 
     # TESTCASE 'user-renable2','user','enable','suspended user','succeeds'
-    (err, out) = rgwadmin(ctx, client, ['user', 'enable', '--uid', user1], 
+    (err, out) = rgwadmin(ctx, client, ['user', 'enable', '--uid', user1],
         check_status=True)
 
     # TESTCASE 'user-renable3','user','enable','reenabled user','can write objects'
@@ -755,8 +755,8 @@ def task(ctx, config):
     # should be private already but guarantee it
     key.set_acl('private')
 
-    (err, out) = rgwadmin(ctx, client, 
-        ['policy', '--bucket', bucket.name, '--object', key.key], 
+    (err, out) = rgwadmin(ctx, client,
+        ['policy', '--bucket', bucket.name, '--object', key.key],
         check_status=True)
 
     acl = key.get_xml_acl()
@@ -766,8 +766,8 @@ def task(ctx, config):
     # add another grantee by making the object public read
     key.set_acl('public-read')
 
-    (err, out) = rgwadmin(ctx, client, 
-        ['policy', '--bucket', bucket.name, '--object', key.key], 
+    (err, out) = rgwadmin(ctx, client,
+        ['policy', '--bucket', bucket.name, '--object', key.key],
         check_status=True)
 
     acl = key.get_xml_acl()
@@ -780,7 +780,7 @@ def task(ctx, config):
         key = boto.s3.key.Key(bucket)
         key.set_contents_from_string(key_name[i])
 
-    (err, out) = rgwadmin(ctx, client, 
+    (err, out) = rgwadmin(ctx, client,
         ['bucket', 'rm', '--bucket', bucket_name, '--purge-objects'],
         check_status=True)
 
@@ -807,8 +807,8 @@ def task(ctx, config):
     key = boto.s3.key.Key(bucket)
     key.set_contents_from_string('twelve')
 
-    (err, out) = rgwadmin(ctx, client, 
-        ['user', 'rm', '--uid', user1, '--purge-data' ], 
+    (err, out) = rgwadmin(ctx, client,
+        ['user', 'rm', '--uid', user1, '--purge-data' ],
         check_status=True)
 
     # TESTCASE 'rm-user3','user','rm','deleted user','fails'
@@ -816,7 +816,7 @@ def task(ctx, config):
     assert err
 
     # TESTCASE 'zone-info', 'zone', 'get', 'get zone info', 'succeeds, has default placement rule'
-    # 
+    #
 
     (err, out) = rgwadmin(ctx, client, ['zone', 'get'])
     orig_placement_pools = len(out['placement_pools'])
@@ -834,8 +834,8 @@ def task(ctx, config):
 
     out['placement_pools'].append(rule)
 
-    (err, out) = rgwadmin(ctx, client, ['zone', 'set'], 
-        stdin=StringIO(json.dumps(out)), 
+    (err, out) = rgwadmin(ctx, client, ['zone', 'set'],
+        stdin=StringIO(json.dumps(out)),
         check_status=True)
 
     (err, out) = rgwadmin(ctx, client, ['zone', 'get'])
index d136dcd44af7269ce55058434814bb48d007eda3..ea32c377972d77ab27edbaa4a225e859065cc4f6 100644 (file)
@@ -220,5 +220,6 @@ def task(ctx, config):
                         backend,
                         ],
                     )
-            except:
+            except Exception:
+                log.exception("Saw exception")
                 pass
index 04ebb2aa33281800c5e6c581216aa47d1d32daa7..b8268016dc7078c20ea3d0aa916f5c876073be12 100644 (file)
@@ -119,8 +119,8 @@ def _delete_dir(ctx, role, subdir):
                 ],
             )
         log.info("Deleted dir {dir}".format(dir=client))
-    except:
-        log.debug("Caught an execption deleting dir {dir}".format(dir=client))
+    except Exception:
+        log.exception("Caught an execption deleting dir {dir}".format(dir=client))
 
     try:
         remote.run(
@@ -131,8 +131,8 @@ def _delete_dir(ctx, role, subdir):
                 ],
             )
         log.info("Deleted dir {dir}".format(dir=mnt))
-    except:
-        log.debug("Caught an execption deleting dir {dir}".format(dir=mnt))
+    except Exception:
+        log.exception("Caught an execption deleting dir {dir}".format(dir=mnt))
 
 def _make_scratch_dir(ctx, role, subdir):
     retVal = False
@@ -153,7 +153,7 @@ def _make_scratch_dir(ctx, role, subdir):
                 ],
             )
         log.info('Did not need to create dir {dir}'.format(dir=mnt))
-    except:
+    except Exception:
         remote.run(
             args=[
                 'mkdir',