From 3981a8f1af4226f93964578face66de4af54e2dd Mon Sep 17 00:00:00 2001 From: Zack Cerza Date: Fri, 30 Aug 2013 10:58:10 -0500 Subject: [PATCH] Never use 'except:' without specifying an Exception. --- teuthology/contextutil.py | 4 +- teuthology/coverage.py | 4 +- teuthology/locker/api.py | 3 +- teuthology/misc.py | 7 +- teuthology/nuke.py | 10 +-- teuthology/parallel.py | 2 +- teuthology/suite.py | 2 +- teuthology/task/ceph.py | 4 +- teuthology/task/ceph_manager.py | 2 +- teuthology/task/cifs-mount.py | 2 +- teuthology/task/dump_stuck.py | 4 +- teuthology/task/install.py | 2 +- teuthology/task/internal.py | 2 +- teuthology/task/kernel.py | 13 ++-- teuthology/task/mon_thrash.py | 2 +- teuthology/task/radosgw-admin.py | 114 +++++++++++++++---------------- teuthology/task/samba.py | 3 +- teuthology/task/workunit.py | 10 +-- 18 files changed, 97 insertions(+), 93 deletions(-) diff --git a/teuthology/contextutil.py b/teuthology/contextutil.py index 690d07f951..bfcb830ae0 100644 --- a/teuthology/contextutil.py +++ b/teuthology/contextutil.py @@ -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 diff --git a/teuthology/coverage.py b/teuthology/coverage.py index 8a31b439a2..2a6c2aea45 100644 --- a/teuthology/coverage.py +++ b/teuthology/coverage.py @@ -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 diff --git a/teuthology/locker/api.py b/teuthology/locker/api.py index 2203fd5e3e..91b0e5effa 100644 --- a/teuthology/locker/api.py +++ b/teuthology/locker/api.py @@ -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 diff --git a/teuthology/misc.py b/teuthology/misc.py index 337d0115f8..7be8fb271a 100644 --- a/teuthology/misc.py +++ b/teuthology/misc.py @@ -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 diff --git a/teuthology/nuke.py b/teuthology/nuke.py index 4aa1fc791d..319b1f2dce 100644 --- a/teuthology/nuke.py +++ b/teuthology/nuke.py @@ -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: diff --git a/teuthology/parallel.py b/teuthology/parallel.py index dbc69ba42a..17312e54b3 100644 --- a/teuthology/parallel.py +++ b/teuthology/parallel.py @@ -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 diff --git a/teuthology/suite.py b/teuthology/suite.py index 40bf2d904c..04c5da2c7e 100644 --- a/teuthology/suite.py +++ b/teuthology/suite.py @@ -405,7 +405,7 @@ def results(): try: _results(args) - except: + except Exception: log.exception('error generating results') raise diff --git a/teuthology/task/ceph.py b/teuthology/task/ceph.py index 4db72943ff..b571cb668b 100644 --- a/teuthology/task/ceph.py +++ b/teuthology/task/ceph.py @@ -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 diff --git a/teuthology/task/ceph_manager.py b/teuthology/task/ceph_manager.py index cff36ede3b..9cf68a2474 100644 --- a/teuthology/task/ceph_manager.py +++ b/teuthology/task/ceph_manager.py @@ -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) diff --git a/teuthology/task/cifs-mount.py b/teuthology/task/cifs-mount.py index ecd61eb440..179738d1fe 100644 --- a/teuthology/task/cifs-mount.py +++ b/teuthology/task/cifs-mount.py @@ -127,5 +127,5 @@ def task(ctx, config): ) import time time.sleep(1) - except: + except Exception: break diff --git a/teuthology/task/dump_stuck.py b/teuthology/task/dump_stuck.py index e7f5c7e3c1..f86feb4180 100644 --- a/teuthology/task/dump_stuck.py +++ b/teuthology/task/dump_stuck.py @@ -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) diff --git a/teuthology/task/install.py b/teuthology/task/install.py index bc01705edc..5653db4b36 100644 --- a/teuthology/task/install.py +++ b/teuthology/task/install.py @@ -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(): diff --git a/teuthology/task/internal.py b/teuthology/task/internal.py index 45dad5d2e1..b1bff23153 100644 --- a/teuthology/task/internal.py +++ b/teuthology/task/internal.py @@ -295,7 +295,7 @@ def archive(ctx, config): try: yield - except: + except Exception: # we need to know this below ctx.summary['success'] = False raise diff --git a/teuthology/task/kernel.py b/teuthology/task/kernel.py index a5ef4ae748..6672305665 100644 --- a/teuthology/task/kernel.py +++ b/teuthology/task/kernel.py @@ -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 diff --git a/teuthology/task/mon_thrash.py b/teuthology/task/mon_thrash.py index 2035bf1e33..fff73d81e8 100644 --- a/teuthology/task/mon_thrash.py +++ b/teuthology/task/mon_thrash.py @@ -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: diff --git a/teuthology/task/radosgw-admin.py b/teuthology/task/radosgw-admin.py index fb29b546be..b1b6cdbf4e 100644 --- a/teuthology/task/radosgw-admin.py +++ b/teuthology/task/radosgw-admin.py @@ -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']) diff --git a/teuthology/task/samba.py b/teuthology/task/samba.py index d136dcd44a..ea32c37797 100644 --- a/teuthology/task/samba.py +++ b/teuthology/task/samba.py @@ -220,5 +220,6 @@ def task(ctx, config): backend, ], ) - except: + except Exception: + log.exception("Saw exception") pass diff --git a/teuthology/task/workunit.py b/teuthology/task/workunit.py index 04ebb2aa33..b8268016dc 100644 --- a/teuthology/task/workunit.py +++ b/teuthology/task/workunit.py @@ -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', -- 2.39.5