From 8a11e4d0530ec78d3181864ecb71875e5809e6b8 Mon Sep 17 00:00:00 2001 From: Zack Cerza Date: Thu, 26 Sep 2013 11:09:55 -0500 Subject: [PATCH] Remove unused variables (cherry picked from commit 581b6b3e977b99fc58fe25e66c933c65e38dc87c) --- teuthology/misc.py | 30 +++++++++++++++----------- teuthology/task/install.py | 1 - teuthology/task/kcon_most.py | 3 +-- teuthology/task/localdir.py | 2 +- teuthology/task/radosgw-admin.py | 1 - teuthology/task/rest-api.py | 3 +-- teuthology/task/sequential.py | 2 +- teuthology/task/watch_notify_stress.py | 2 -- teuthology/task_util/rgw.py | 2 +- 9 files changed, 22 insertions(+), 24 deletions(-) diff --git a/teuthology/misc.py b/teuthology/misc.py index 175720984e8..eb77fb83d5a 100644 --- a/teuthology/misc.py +++ b/teuthology/misc.py @@ -337,6 +337,7 @@ def move_file(remote, from_path, to_path, sudo=False): stdout=StringIO(), ) + def delete_file(remote, path, sudo=False, force=False): args = [] if sudo: @@ -345,14 +346,15 @@ def delete_file(remote, path, sudo=False, force=False): if force: args.extend(['-f']) args.extend([ - '--', - path, - ]) - proc = remote.run( + '--', + path, + ]) + remote.run( args=args, stdout=StringIO(), ) + def remove_lines_from_file(remote, path, line_is_valid_test, string_to_test_for): # read in the specified file in_data = get_file(remote, path, False) @@ -414,6 +416,7 @@ def remote_mktemp(remote, sudo=False): data = proc.stdout.getvalue() return data + def create_file(remote, path, data="", permissions=str(644), sudo=False): """ Create a file on the remote host. @@ -422,15 +425,15 @@ def create_file(remote, path, data="", permissions=str(644), sudo=False): if sudo: args.append('sudo') args.extend([ - 'touch', - path, - run.Raw('&&'), - 'chmod', - permissions, - '--', - path - ]) - proc = remote.run( + 'touch', + path, + run.Raw('&&'), + 'chmod', + permissions, + '--', + path + ]) + remote.run( args=args, stdout=StringIO(), ) @@ -438,6 +441,7 @@ def create_file(remote, path, data="", permissions=str(644), sudo=False): if "" != data: append_lines_to_file(remote, path, data, sudo) + def get_file(remote, path, sudo=False): """ Read a file from remote host into memory. diff --git a/teuthology/task/install.py b/teuthology/task/install.py index 2b8b706188e..b96b20cbd5b 100644 --- a/teuthology/task/install.py +++ b/teuthology/task/install.py @@ -287,7 +287,6 @@ def _update_rpm_package_list_and_install(ctx, remote, rpm, config): host = ctx.teuthology_config.get('gitbuilder_host', 'gitbuilder.ceph.com') dist_release = baseparms['dist_release'] - distro_release = baseparms['distro_release'] start_of_url = 'http://{host}/ceph-rpm-{distro_release}-{arch}-{flavor}/{uri}'.format(host=host, **baseparms) ceph_release = 'ceph-release-{release}.{dist_release}.noarch'.format( release=RELEASE, dist_release=dist_release) diff --git a/teuthology/task/kcon_most.py b/teuthology/task/kcon_most.py index eb5f54702db..ef5b06bfa9d 100644 --- a/teuthology/task/kcon_most.py +++ b/teuthology/task/kcon_most.py @@ -5,6 +5,7 @@ from teuthology import misc as teuthology log = logging.getLogger(__name__) + @contextlib.contextmanager def task(ctx, config): """ @@ -35,8 +36,6 @@ def task(ctx, config): for id_ in teuthology.all_roles_of_type(ctx.cluster, 'client')] clients = list(teuthology.get_clients(ctx=ctx, roles=config)) - testdir = teuthology.get_testdir(ctx) - for id_, remote in clients: # TODO: Don't have to run this more than once per node (remote) log.info('Enable logging on client.{id} at {remote} ...'.format( diff --git a/teuthology/task/localdir.py b/teuthology/task/localdir.py index 8b54217e44d..753362554cf 100644 --- a/teuthology/task/localdir.py +++ b/teuthology/task/localdir.py @@ -3,10 +3,10 @@ import logging import os from teuthology import misc as teuthology -from ..orchestra import run log = logging.getLogger(__name__) + @contextlib.contextmanager def task(ctx, config): """ diff --git a/teuthology/task/radosgw-admin.py b/teuthology/task/radosgw-admin.py index 59aef938db8..f91747305a6 100644 --- a/teuthology/task/radosgw-admin.py +++ b/teuthology/task/radosgw-admin.py @@ -735,7 +735,6 @@ def task(ctx, config): assert err # delete should fail because ``key`` still exists - fails = False try: bucket.delete() except boto.exception.S3ResponseError as e: diff --git a/teuthology/task/rest-api.py b/teuthology/task/rest-api.py index 817add29f04..481bd7fd8d2 100644 --- a/teuthology/task/rest-api.py +++ b/teuthology/task/rest-api.py @@ -8,13 +8,12 @@ from teuthology.task.ceph import CephState log = logging.getLogger(__name__) + @contextlib.contextmanager def run_rest_api_daemon(ctx, api_clients): if not hasattr(ctx, 'daemons'): ctx.daemons = CephState() remotes = ctx.cluster.only(teuthology.is_type('client')).remotes - testdir = teuthology.get_testdir(ctx) - coverage_dir = '{tdir}/archive/coverage'.format(tdir=testdir) for rems, roles in remotes.iteritems(): for whole_id_ in roles: if whole_id_ in api_clients: diff --git a/teuthology/task/sequential.py b/teuthology/task/sequential.py index 73ab7fc7885..505bb65d3e7 100644 --- a/teuthology/task/sequential.py +++ b/teuthology/task/sequential.py @@ -46,6 +46,6 @@ def task(ctx, config): exc_info = sys.exc_info() while stack: mgr = stack.pop() - endr = mgr.__exit__(*exc_info) + mgr.__exit__(*exc_info) finally: del exc_info diff --git a/teuthology/task/watch_notify_stress.py b/teuthology/task/watch_notify_stress.py index 7aec56b2841..da52ba010fd 100644 --- a/teuthology/task/watch_notify_stress.py +++ b/teuthology/task/watch_notify_stress.py @@ -32,8 +32,6 @@ def task(ctx, config): remotes = [] - testdir = teuthology.get_testdir(ctx) - for role in config.get('clients', ['client.0']): assert isinstance(role, basestring) PREFIX = 'client.' diff --git a/teuthology/task_util/rgw.py b/teuthology/task_util/rgw.py index 82c387fd7ac..14216b92bad 100644 --- a/teuthology/task_util/rgw.py +++ b/teuthology/task_util/rgw.py @@ -113,7 +113,7 @@ def radosgw_agent_sync(ctx, agent_host, agent_port): def radosgw_agent_sync_all(ctx): if ctx.radosgw_agent.procs: for agent_client, c_config in ctx.radosgw_agent.config.iteritems(): - dest_zone = zone_for_client(ctx, agent_client) + zone_for_client(ctx, agent_client) sync_host, sync_port = get_sync_agent(ctx, agent_client) log.debug('doing a sync via {host1}'.format(host1=sync_host)) radosgw_agent_sync(ctx, sync_host, sync_port)