From 2fa726b88c9f655006a1cc009c522ad003b07016 Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Fri, 19 Jun 2020 19:26:10 +0800 Subject: [PATCH] qa/tasks: flake8 fixes Signed-off-by: Kefu Chai --- qa/tasks/ceph.py | 3 +-- qa/tasks/ceph_deploy.py | 2 +- qa/tasks/ceph_manager.py | 2 -- qa/tasks/ceph_objectstore_tool.py | 6 +++--- qa/tasks/cephadm.py | 7 +------ qa/tasks/scrub.py | 2 +- qa/tasks/systemd.py | 2 +- 7 files changed, 8 insertions(+), 16 deletions(-) diff --git a/qa/tasks/ceph.py b/qa/tasks/ceph.py index 4bb5c94a625..b83995acb40 100644 --- a/qa/tasks/ceph.py +++ b/qa/tasks/ceph.py @@ -26,7 +26,7 @@ from teuthology import misc as teuthology from teuthology import contextutil from teuthology import exceptions from teuthology.orchestra import run -import tasks.ceph_client as cclient +from tasks import ceph_client as cclient from teuthology.orchestra.daemon import DaemonGroup from tasks.daemonwatchdog import DaemonWatchdog @@ -1477,7 +1477,6 @@ def suppress_mon_health_to_clog(ctx, config): restore the tweaked option at the /end/ of 'tasks' block. """ if config.get('mon-health-to-clog', 'true') == 'false': - saved_options = {} cluster = config.get('cluster', 'ceph') manager = ctx.managers[cluster] manager.raw_cluster_command( diff --git a/qa/tasks/ceph_deploy.py b/qa/tasks/ceph_deploy.py index 149607ca4ec..95687aba9e9 100644 --- a/qa/tasks/ceph_deploy.py +++ b/qa/tasks/ceph_deploy.py @@ -701,7 +701,7 @@ def cli_test(ctx, config): time.sleep(4) for i in range(3): umount_dev = "{d}1".format(d=devs[i]) - r = remote.run(args=['sudo', 'umount', run.Raw(umount_dev)]) + remote.run(args=['sudo', 'umount', run.Raw(umount_dev)]) cmd = 'purge ' + nodename execute_cdeploy(admin, cmd, path) cmd = 'purgedata ' + nodename diff --git a/qa/tasks/ceph_manager.py b/qa/tasks/ceph_manager.py index 2516043217b..f25d8a08df9 100644 --- a/qa/tasks/ceph_manager.py +++ b/qa/tasks/ceph_manager.py @@ -26,7 +26,6 @@ from teuthology.orchestra.remote import Remote from teuthology.orchestra import run from teuthology.exceptions import CommandFailedError from tasks.thrasher import Thrasher -from six import StringIO try: from subprocess import DEVNULL # py3k @@ -39,7 +38,6 @@ log = logging.getLogger(__name__) # this is for cephadm clusters def shell(ctx, cluster_name, remote, args, name=None, **kwargs): - testdir = teuthology.get_testdir(ctx) extra_args = [] if name: extra_args = ['-n', name] diff --git a/qa/tasks/ceph_objectstore_tool.py b/qa/tasks/ceph_objectstore_tool.py index d4facfd782f..e19a0bd218e 100644 --- a/qa/tasks/ceph_objectstore_tool.py +++ b/qa/tasks/ceph_objectstore_tool.py @@ -511,12 +511,12 @@ def test_objectstore(ctx, config, cli_remote, REP_POOL, REP_NAME, ec=False): try: info = remote.sh(cmd, wait=True) except CommandFailedError as e: - log.error("Failure of --op info command with {ret}". - format(e.exitstatus)) + log.error("Failure of --op info command with %s", + e.exitstatus) ERRORS += 1 continue if not str(pg) in info: - log.error("Bad data from info: {info}".format(info=info)) + log.error("Bad data from info: %s", info) ERRORS += 1 log.info("Test pg logging") diff --git a/qa/tasks/cephadm.py b/qa/tasks/cephadm.py index 51fba7f8e1b..cb873aaccc4 100644 --- a/qa/tasks/cephadm.py +++ b/qa/tasks/cephadm.py @@ -31,7 +31,7 @@ log = logging.getLogger(__name__) def _shell(ctx, cluster_name, remote, args, extra_cephadm_args=[], **kwargs): - testdir = teuthology.get_testdir(ctx) + teuthology.get_testdir(ctx) return remote.run( args=[ 'sudo', @@ -769,12 +769,9 @@ def ceph_rgw(ctx, config): @contextlib.contextmanager def ceph_clients(ctx, config): cluster_name = config['cluster'] - testdir = teuthology.get_testdir(ctx) log.info('Setting up client nodes...') clients = ctx.cluster.only(teuthology.is_type('client', cluster_name)) - testdir = teuthology.get_testdir(ctx) - coverage_dir = '{tdir}/archive/coverage'.format(tdir=testdir) for remote, roles_for_host in clients.remotes.items(): for role in teuthology.cluster_roles_of_type(roles_for_host, 'client', cluster_name): @@ -1122,8 +1119,6 @@ def task(ctx, config): teuthology.deep_merge(config, overrides.get('cephadm', {})) log.info('Config: ' + str(config)) - testdir = teuthology.get_testdir(ctx) - # set up cluster context if not hasattr(ctx, 'ceph'): ctx.ceph = {} diff --git a/qa/tasks/scrub.py b/qa/tasks/scrub.py index 7cf304e845d..ddc1a9164cf 100644 --- a/qa/tasks/scrub.py +++ b/qa/tasks/scrub.py @@ -7,7 +7,7 @@ import logging import random import time -import tasks.ceph_manager +from tasks import ceph_manager from teuthology import misc as teuthology log = logging.getLogger(__name__) diff --git a/qa/tasks/systemd.py b/qa/tasks/systemd.py index 745f503c903..1728b920f38 100644 --- a/qa/tasks/systemd.py +++ b/qa/tasks/systemd.py @@ -69,7 +69,7 @@ def task(ctx, config): mon_role_name = 'mon.' + name mds_role_name = 'mds.' + name mgr_role_name = 'mgr.' + name - m_osd = re.search('--id (\d+) --setuser ceph', r.stdout.getvalue()) + m_osd = re.search('--id (\d+) --setuser ceph', ps_eaf) if m_osd: osd_service = 'ceph-osd@{m}.service'.format(m=m_osd.group(1)) remote.run(args=['sudo', 'systemctl', 'status', -- 2.47.3