From 092aa39237a38165fde2c0f9d46e31f9dc16564a Mon Sep 17 00:00:00 2001 From: Kyr Shatskyy Date: Thu, 3 Oct 2019 15:31:51 +0200 Subject: [PATCH] python3: get rid of iteritems Signed-off-by: Kyr Shatskyy --- teuthology/config.py | 2 +- teuthology/coverage.py | 4 ++-- teuthology/kill.py | 2 +- teuthology/lock/cli.py | 2 +- teuthology/lock/keys.py | 2 +- teuthology/lock/query.py | 2 +- teuthology/lock/util.py | 2 +- teuthology/misc.py | 12 ++++++------ teuthology/nuke/__init__.py | 6 +++--- teuthology/nuke/actions.py | 2 +- teuthology/openstack/__init__.py | 6 +++--- teuthology/openstack/test/test_openstack.py | 2 +- teuthology/orchestra/cluster.py | 4 ++-- teuthology/orchestra/monkey.py | 2 +- teuthology/orchestra/opsys.py | 4 ++-- teuthology/prune.py | 2 +- teuthology/run.py | 2 +- teuthology/run_tasks.py | 2 +- teuthology/suite/__init__.py | 2 +- teuthology/suite/test/test_build_matrix.py | 4 ++-- teuthology/task/__init__.py | 4 ++-- teuthology/task/background_exec.py | 4 ++-- teuthology/task/ceph_ansible.py | 2 +- teuthology/task/cephmetrics.py | 2 +- teuthology/task/console_log.py | 2 +- teuthology/task/exec.py | 2 +- teuthology/task/full_sequential.py | 2 +- teuthology/task/full_sequential_finally.py | 2 +- teuthology/task/hadoop.py | 2 +- teuthology/task/install/__init__.py | 4 ++-- teuthology/task/internal/__init__.py | 4 ++-- teuthology/task/kernel.py | 18 +++++++++--------- teuthology/task/loop.py | 2 +- teuthology/task/parallel.py | 2 +- teuthology/task/parallel_example.py | 2 +- teuthology/task/pexec.py | 4 ++-- teuthology/task/selinux.py | 2 +- teuthology/task/sequential.py | 2 +- teuthology/test/task/test_pcp.py | 2 +- 39 files changed, 65 insertions(+), 65 deletions(-) diff --git a/teuthology/config.py b/teuthology/config.py index e212c3366..2a26e3f49 100644 --- a/teuthology/config.py +++ b/teuthology/config.py @@ -222,7 +222,7 @@ class FakeNamespace(YamlConfig): correctly. """ result = dict() - for key, value in config_dict.iteritems(): + for key, value in config_dict.items(): new_key = key if new_key.startswith("--"): new_key = new_key[2:] diff --git a/teuthology/coverage.py b/teuthology/coverage.py index 46706360e..63d33e36f 100644 --- a/teuthology/coverage.py +++ b/teuthology/coverage.py @@ -46,7 +46,7 @@ def connect_to_db(): def store_coverage(test_coverage, rev, suite): with closing(connect_to_db()) as db: rows = [] - for test, coverage in test_coverage.iteritems(): + for test, coverage in test_coverage.items(): flattened_cov = [item for sublist in coverage for item in sublist] rows.append([rev, test, suite] + flattened_cov) log.debug('inserting rows into db: %s', str(rows)) @@ -156,7 +156,7 @@ def analyze(test_dir, cov_tools_dir, lcov_output, html_output, skip_init): ) test_coverage = {} - for test, summary in test_summaries.iteritems(): + for test, summary in test_summaries.items(): lcov_file = '{name}.lcov'.format(name=test) log.info('analyzing coverage for %s', test) diff --git a/teuthology/kill.py b/teuthology/kill.py index 931c7872f..da7387076 100755 --- a/teuthology/kill.py +++ b/teuthology/kill.py @@ -88,7 +88,7 @@ def find_run_info(serializer, run_name): job_num = 0 jobs = serializer.jobs_for_run(run_name) job_total = len(jobs) - for (job_id, job_dir) in jobs.iteritems(): + for (job_id, job_dir) in jobs.items(): if not os.path.isdir(job_dir): continue job_num += 1 diff --git a/teuthology/lock/cli.py b/teuthology/lock/cli.py index 5df9ad092..73e571662 100644 --- a/teuthology/lock/cli.py +++ b/teuthology/lock/cli.py @@ -249,7 +249,7 @@ def do_summary(ctx): lockd[who][1] += 1 if l['up'] else 0 lockd[who][2] = l['machine_type'] - locks = sorted([p for p in lockd.iteritems() + locks = sorted([p for p in lockd.items() ], key=lambda sort: (sort[1][2], sort[1][0])) total_count, total_up = 0, 0 print "TYPE COUNT UP OWNER" diff --git a/teuthology/lock/keys.py b/teuthology/lock/keys.py index 9f8497e50..3ed2f987c 100644 --- a/teuthology/lock/keys.py +++ b/teuthology/lock/keys.py @@ -17,7 +17,7 @@ def do_update_keys(machines, all_=False, _raise=True): def push_new_keys(keys_dict, reference): ret = 0 - for hostname, pubkey in keys_dict.iteritems(): + for hostname, pubkey in keys_dict.items(): log.info('Checking %s', hostname) if reference[hostname]['ssh_pub_key'] != pubkey: log.info('New key found. Updating...') diff --git a/teuthology/lock/query.py b/teuthology/lock/query.py index 2adf12e23..9dcdd7701 100644 --- a/teuthology/lock/query.py +++ b/teuthology/lock/query.py @@ -50,7 +50,7 @@ def is_vm(name=None, status=None): def list_locks(keyed_by_name=False, **kwargs): uri = os.path.join(config.lock_server, 'nodes', '') - for key, value in kwargs.iteritems(): + for key, value in kwargs.items(): if kwargs[key] is False: kwargs[key] = '0' if kwargs[key] is True: diff --git a/teuthology/lock/util.py b/teuthology/lock/util.py index 5dc0814d4..91f957eab 100644 --- a/teuthology/lock/util.py +++ b/teuthology/lock/util.py @@ -77,7 +77,7 @@ def json_matching_statuses(json_file_or_str, statuses): return_statuses = list() for status in statuses: - for k, v in query.iteritems(): + for k, v in query.items(): if not misc.is_in_dict(k, v, status): break else: diff --git a/teuthology/misc.py b/teuthology/misc.py index 78d3d10c5..832c726e8 100644 --- a/teuthology/misc.py +++ b/teuthology/misc.py @@ -331,7 +331,7 @@ def skeleton_config(ctx, roles, ips, cluster='ceph', mons = get_mons(roles=roles, ips=ips, mon_bind_msgr2=mon_bind_msgr2, mon_bind_addrvec=mon_bind_addrvec) - for role, addr in mons.iteritems(): + for role, addr in mons.items(): mon_cluster, _, _ = split_role(role) if mon_cluster != cluster: continue @@ -406,7 +406,7 @@ def all_roles(cluster): :param cluster: Cluster extracted from the ctx. """ - for _, roles_for_host in cluster.remotes.iteritems(): + for _, roles_for_host in cluster.remotes.items(): for name in roles_for_host: yield name @@ -419,7 +419,7 @@ def all_roles_of_type(cluster, type_): :param cluster: Cluster extracted from the ctx. :param type_: role type """ - for _, roles_for_host in cluster.remotes.iteritems(): + for _, roles_for_host in cluster.remotes.items(): for id_ in roles_of_type(roles_for_host, type_): yield id_ @@ -478,7 +478,7 @@ def create_simple_monmap(ctx, remote, conf, path=None, Each invocation returns the next monitor address """ - for section, data in conf.iteritems(): + for section, data in conf.items(): PREFIX = 'mon.' if not section.startswith(PREFIX): continue @@ -1110,7 +1110,7 @@ def deep_merge(a, b): return a if isinstance(a, dict): assert isinstance(b, dict) - for (k, v) in b.iteritems(): + for (k, v) in b.items(): if k in a: a[k] = deep_merge(a[k], v) else: @@ -1364,7 +1364,7 @@ def is_in_dict(searchkey, searchval, d): """ val = d.get(searchkey, None) if isinstance(val, dict) and isinstance(searchval, dict): - for foundkey, foundval in searchval.iteritems(): + for foundkey, foundval in searchval.items(): if not is_in_dict(foundkey, foundval, val): return False return True diff --git a/teuthology/nuke/__init__.py b/teuthology/nuke/__init__.py index 343e2ff13..5c105ef3d 100644 --- a/teuthology/nuke/__init__.py +++ b/teuthology/nuke/__init__.py @@ -63,7 +63,7 @@ OPENSTACK_DELAY = 30 * 60 def stale_openstack_instances(ctx, instances, locked_nodes): - for (instance_id, instance) in instances.iteritems(): + for (instance_id, instance) in instances.items(): i = OpenStackInstance(instance_id) if not i.exists(): log.debug("stale-openstack: {instance} disappeared, ignored" @@ -136,7 +136,7 @@ def stale_openstack_volumes(ctx, volumes): def stale_openstack_nodes(ctx, instances, locked_nodes): names = set([ i['Name'] for i in instances.values() ]) - for (name, node) in locked_nodes.iteritems(): + for (name, node) in locked_nodes.items(): name = decanonicalize_hostname(name) if node['machine_type'] != 'openstack': continue @@ -253,7 +253,7 @@ def nuke(ctx, should_unlock, sync_clocks=True, reboot_all=True, noipmi=False): "Not nuking %s because description doesn't match", lock['name']) with parallel() as p: - for target, hostkey in ctx.config['targets'].iteritems(): + for target, hostkey in ctx.config['targets'].items(): p.spawn( nuke_one, ctx, diff --git a/teuthology/nuke/actions.py b/teuthology/nuke/actions.py index 5a1db5604..8c088aa2f 100644 --- a/teuthology/nuke/actions.py +++ b/teuthology/nuke/actions.py @@ -193,7 +193,7 @@ def reset_syslog_dir(ctx): ) nodes[remote.name] = proc - for name, proc in nodes.iteritems(): + for name, proc in nodes.items(): log.info('Waiting for %s to restart syslog...', name) proc.wait() diff --git a/teuthology/openstack/__init__.py b/teuthology/openstack/__init__.py index 1f006dedc..c4668fdf7 100644 --- a/teuthology/openstack/__init__.py +++ b/teuthology/openstack/__init__.py @@ -68,7 +68,7 @@ class OpenStackInstance(object): if info is None: self.set_info() else: - self.info = dict(map(lambda (k,v): (k.lower(), v), info.iteritems())) + self.info = dict(map(lambda (k,v): (k.lower(), v), info.items())) def set_info(self): try: @@ -458,7 +458,7 @@ class OpenStack(object): if resource in hint: new = hint[resource] current = result[resource] - for key, value in hint[resource].iteritems(): + for key, value in hint[resource].items(): current[key] = max(current[key], new[key]) return result @@ -920,7 +920,7 @@ ssh access : ssh {identity}{username}@{ip} # logs in /usr/share/nginx/ '../..', self.user_data) template = open(user_data).read() openrc = '' - for (var, value) in os.environ.iteritems(): + for (var, value) in os.environ.items(): if var in ('OS_TOKEN_VALUE', 'OS_TOKEN_EXPIRES'): continue if var.startswith('OS_'): diff --git a/teuthology/openstack/test/test_openstack.py b/teuthology/openstack/test/test_openstack.py index 49a13da0c..1cf0b9df8 100644 --- a/teuthology/openstack/test/test_openstack.py +++ b/teuthology/openstack/test/test_openstack.py @@ -1501,7 +1501,7 @@ class TestOpenStack(TestOpenStackBase): } os.environ['OS_REGION_NAME'] = 'REGION' os.environ['OS_TENANT_ID'] = 'TENANT' - for (type, cmds) in type2cmd.iteritems(): + for (type, cmds) in type2cmd.items(): for cmd in cmds: assert ("//" + type) in o.get_os_url(cmd + " ") for type in type2cmd.keys(): diff --git a/teuthology/orchestra/cluster.py b/teuthology/orchestra/cluster.py index 36febec9c..ebae8de21 100644 --- a/teuthology/orchestra/cluster.py +++ b/teuthology/orchestra/cluster.py @@ -104,7 +104,7 @@ class Cluster(object): want = frozenset(r for r in roles if not callable(r)) matchers = [r for r in roles if callable(r)] - for remote, has_roles in self.remotes.iteritems(): + for remote, has_roles in self.remotes.items(): # strings given as roles must all match if frozenset(has_roles) & want != want: # not a match @@ -129,7 +129,7 @@ class Cluster(object): """ matches = self.only(*roles) c = self.__class__() - for remote, has_roles in self.remotes.iteritems(): + for remote, has_roles in self.remotes.items(): if remote not in matches.remotes: c.add(remote, has_roles) return c diff --git a/teuthology/orchestra/monkey.py b/teuthology/orchestra/monkey.py index 9b09c7a8d..e13e77305 100644 --- a/teuthology/orchestra/monkey.py +++ b/teuthology/orchestra/monkey.py @@ -49,7 +49,7 @@ def patch_all(): """ Run all the patch_* functions in this module. """ - monkeys = [(k, v) for (k, v) in globals().iteritems() if k.startswith('patch_') and k != 'patch_all'] + monkeys = [(k, v) for (k, v) in globals().items() if k.startswith('patch_') and k != 'patch_all'] monkeys.sort() for k, v in monkeys: log.debug('Patching %s', k) diff --git a/teuthology/orchestra/opsys.py b/teuthology/orchestra/opsys.py index 20795dcc0..ef3162c62 100644 --- a/teuthology/orchestra/opsys.py +++ b/teuthology/orchestra/opsys.py @@ -83,13 +83,13 @@ class OS(object): @staticmethod def _version_to_codename(name, version): - for (_version, codename) in DISTRO_CODENAME_MAP[name].iteritems(): + for (_version, codename) in DISTRO_CODENAME_MAP[name].items(): if str(version) == _version or str(version).split('.')[0] == _version: return codename @staticmethod def _codename_to_version(name, codename): - for (version, _codename) in DISTRO_CODENAME_MAP[name].iteritems(): + for (version, _codename) in DISTRO_CODENAME_MAP[name].items(): if codename == _codename: return version raise RuntimeError("No version found for %s %s !" % ( diff --git a/teuthology/prune.py b/teuthology/prune.py index cf7bda867..a98547a67 100644 --- a/teuthology/prune.py +++ b/teuthology/prune.py @@ -178,7 +178,7 @@ def maybe_remove_remotes(run_dir, days, dry_run=False): if (should_preserve(item) or not os.path.isdir(item) or not is_old_enough(item, days)): continue - for (subdir, description) in subdirs.iteritems(): + for (subdir, description) in subdirs.items(): _maybe_remove_subdir(item, subdir, days, description, dry_run) diff --git a/teuthology/run.py b/teuthology/run.py index ceaa97158..4d3099268 100644 --- a/teuthology/run.py +++ b/teuthology/run.py @@ -288,7 +288,7 @@ def get_teuthology_command(args): and returns it as a string. """ cmd = ["teuthology"] - for key, value in args.iteritems(): + for key, value in args.items(): if value: # an option, not an argument if not key.startswith("<"): diff --git a/teuthology/run_tasks.py b/teuthology/run_tasks.py index 36d47739a..f55d60ac4 100644 --- a/teuthology/run_tasks.py +++ b/teuthology/run_tasks.py @@ -78,7 +78,7 @@ def run_tasks(tasks, ctx): try: for taskdict in tasks: try: - ((taskname, config),) = taskdict.iteritems() + ((taskname, config),) = taskdict.items() except (ValueError, AttributeError): raise RuntimeError('Invalid task definition: %s' % taskdict) log.info('Running task %s...', taskname) diff --git a/teuthology/suite/__init__.py b/teuthology/suite/__init__.py index 3f30170cc..a7060d2ea 100644 --- a/teuthology/suite/__init__.py +++ b/teuthology/suite/__init__.py @@ -49,7 +49,7 @@ def process_args(args): '': 'base_yaml_paths', 'filter': 'filter_in', } - for (key, value) in args.iteritems(): + for (key, value) in args.items(): # Translate --foo-bar to foo_bar key = key.lstrip('--').replace('-', '_') # Rename the key if necessary diff --git a/teuthology/suite/test/test_build_matrix.py b/teuthology/suite/test/test_build_matrix.py index e4e58ab38..a9764cd72 100644 --- a/teuthology/suite/test/test_build_matrix.py +++ b/teuthology/suite/test/test_build_matrix.py @@ -664,7 +664,7 @@ class TestSubset(object): @staticmethod def verify_facets(tree, description_list, subset, mat, first, matlimit): def flatten(tree): - for k,v in tree.iteritems(): + for k,v in tree.items(): if v is None and '.yaml' in k: yield k elif v is not None and '.disable' not in k: @@ -673,7 +673,7 @@ class TestSubset(object): def pptree(tree, tabs=0): ret = "" - for k, v in tree.iteritems(): + for k, v in tree.items(): if v is None: ret += ('\t'*tabs) + k.ljust(10) + "\n" else: diff --git a/teuthology/task/__init__.py b/teuthology/task/__init__.py index 725c5c872..d21ff509e 100644 --- a/teuthology/task/__init__.py +++ b/teuthology/task/__init__.py @@ -72,10 +72,10 @@ class Task(object): for host_spec in host_specs: role_matches = self.ctx.cluster.only(host_spec) if len(role_matches.remotes) > 0: - for (remote, roles) in role_matches.remotes.iteritems(): + for (remote, roles) in role_matches.remotes.items(): cluster.add(remote, roles) elif isinstance(host_spec, basestring): - for (remote, roles) in self.ctx.cluster.remotes.iteritems(): + for (remote, roles) in self.ctx.cluster.remotes.items(): if remote.name.split('@')[-1] == host_spec or \ remote.shortname == host_spec: cluster.add(remote, roles) diff --git a/teuthology/task/background_exec.py b/teuthology/task/background_exec.py index c95422421..6691b50d4 100644 --- a/teuthology/task/background_exec.py +++ b/teuthology/task/background_exec.py @@ -46,7 +46,7 @@ def task(ctx, config): testdir = misc.get_testdir(ctx) tasks = {} - for role, cmd in config.iteritems(): + for role, cmd in config.items(): (remote,) = ctx.cluster.only(role).remotes.iterkeys() log.info('Running background command on role %s host %s', role, remote.name) @@ -70,7 +70,7 @@ def task(ctx, config): yield finally: - for name, task in tasks.iteritems(): + for name, task in tasks.items(): log.info('Stopping background command on %s', name) task.stdin.close() run.wait(tasks.itervalues()) diff --git a/teuthology/task/ceph_ansible.py b/teuthology/task/ceph_ansible.py index 63b2c848b..f8b3b0776 100644 --- a/teuthology/task/ceph_ansible.py +++ b/teuthology/task/ceph_ansible.py @@ -140,7 +140,7 @@ class CephAnsible(Task): for group in sorted(self.groups_to_roles.keys()): role_prefix = self.groups_to_roles[group] want = lambda role: role.startswith(role_prefix) - for (remote, roles) in self.cluster.only(want).remotes.iteritems(): + for (remote, roles) in self.cluster.only(want).remotes.items(): hostname = remote.hostname host_vars = self.get_host_vars(remote) if group not in hosts_dict: diff --git a/teuthology/task/cephmetrics.py b/teuthology/task/cephmetrics.py index 6e4b677a6..0de36e303 100644 --- a/teuthology/task/cephmetrics.py +++ b/teuthology/task/cephmetrics.py @@ -40,7 +40,7 @@ class CephMetrics(Ansible): if group not in hosts_dict: hosts_dict[group] = dict(hosts=dict()) group_dict = hosts_dict[group]['hosts'] - for (remote, roles) in self.cluster.only(want).remotes.iteritems(): + for (remote, roles) in self.cluster.only(want).remotes.items(): hostname = remote.hostname group_dict[hostname] = dict( ansible_user=remote.user, diff --git a/teuthology/task/console_log.py b/teuthology/task/console_log.py index 7c1c70142..01b89351f 100644 --- a/teuthology/task/console_log.py +++ b/teuthology/task/console_log.py @@ -29,7 +29,7 @@ class ConsoleLog(Task): if not hasattr(self.ctx, 'cluster'): return new_cluster = Cluster() - for (remote, roles) in self.cluster.remotes.iteritems(): + for (remote, roles) in self.cluster.remotes.items(): if not hasattr(remote.console, 'spawn_sol_log'): log.debug("%s does not support IPMI; excluding", remote.shortname) diff --git a/teuthology/task/exec.py b/teuthology/task/exec.py index df66b1a1d..0f8308ab9 100644 --- a/teuthology/task/exec.py +++ b/teuthology/task/exec.py @@ -40,7 +40,7 @@ def task(ctx, config): roles = teuthology.all_roles(ctx.cluster) config = dict((id_, a) for id_ in roles) - for role, ls in config.iteritems(): + for role, ls in config.items(): (remote,) = ctx.cluster.only(role).remotes.iterkeys() log.info('Running commands on role %s host %s', role, remote.name) for c in ls: diff --git a/teuthology/task/full_sequential.py b/teuthology/task/full_sequential.py index 4114d92da..a9990f2aa 100644 --- a/teuthology/task/full_sequential.py +++ b/teuthology/task/full_sequential.py @@ -25,7 +25,7 @@ def task(ctx, config): for entry in config: if not isinstance(entry, dict): entry = ctx.config.get(entry, {}) - ((taskname, confg),) = entry.iteritems() + ((taskname, confg),) = entry.items() log.info('In full_sequential, running task %s...' % taskname) mgr = run_tasks.run_one_task(taskname, ctx=ctx, config=confg) if hasattr(mgr, '__enter__'): diff --git a/teuthology/task/full_sequential_finally.py b/teuthology/task/full_sequential_finally.py index a24a34477..76e3bbbde 100644 --- a/teuthology/task/full_sequential_finally.py +++ b/teuthology/task/full_sequential_finally.py @@ -40,7 +40,7 @@ def task(ctx, config): for entry in config: if not isinstance(entry, dict): entry = ctx.config.get(entry, {}) - ((taskname, confg),) = entry.iteritems() + ((taskname, confg),) = entry.items() log.info('In full_sequential_finally, running task %s...' % taskname) mgr = run_tasks.run_one_task(taskname, ctx=ctx, config=confg) if hasattr(mgr, '__enter__'): diff --git a/teuthology/task/hadoop.py b/teuthology/task/hadoop.py index a798695d8..53f07d89b 100644 --- a/teuthology/task/hadoop.py +++ b/teuthology/task/hadoop.py @@ -12,7 +12,7 @@ HADOOP_2x_URL = "https://archive.apache.org/dist/hadoop/core/hadoop-2.5.2/hadoop def dict_to_hadoop_conf(items): out = "\n" - for key, value in items.iteritems(): + for key, value in items.items(): out += " \n" out += " " + key + "\n" out += " " + value + "\n" diff --git a/teuthology/task/install/__init__.py b/teuthology/task/install/__init__.py index b83a7e78c..711660ff6 100644 --- a/teuthology/task/install/__init__.py +++ b/teuthology/task/install/__init__.py @@ -282,7 +282,7 @@ def upgrade_remote_to_config(ctx, config): remotes[remote] = config.get(role) result = {} - for remote, node in remotes.iteritems(): + for remote, node in remotes.items(): if not node: node = {} @@ -316,7 +316,7 @@ def upgrade_common(ctx, config, deploy_style): extra_pkgs = config.get('extra_packages', []) log.info('extra packages: {packages}'.format(packages=extra_pkgs)) - for remote, node in remotes.iteritems(): + for remote, node in remotes.items(): system_type = teuthology.get_system_type(remote) assert system_type in ('deb', 'rpm') diff --git a/teuthology/task/internal/__init__.py b/teuthology/task/internal/__init__.py index 0c674e317..cf255a199 100644 --- a/teuthology/task/internal/__init__.py +++ b/teuthology/task/internal/__init__.py @@ -142,7 +142,7 @@ def add_remotes(ctx, config): machs = [] for name in ctx.config['targets'].iterkeys(): machs.append(name) - for t, key in ctx.config['targets'].iteritems(): + for t, key in ctx.config['targets'].items(): t = misc.canonicalize_hostname(t) try: if ctx.config['sshkeys'] == 'ignore': @@ -245,7 +245,7 @@ def serialize_remote_roles(ctx, config): with open(os.path.join(ctx.archive, 'info.yaml'), 'r+') as info_file: info_yaml = yaml.safe_load(info_file) info_file.seek(0) - info_yaml['cluster'] = dict([(rem.name, {'roles': roles}) for rem, roles in ctx.cluster.remotes.iteritems()]) + info_yaml['cluster'] = dict([(rem.name, {'roles': roles}) for rem, roles in ctx.cluster.remotes.items()]) yaml.safe_dump(info_yaml, info_file, default_flow_style=False) diff --git a/teuthology/task/kernel.py b/teuthology/task/kernel.py index eba98a03c..ffb236fdb 100644 --- a/teuthology/task/kernel.py +++ b/teuthology/task/kernel.py @@ -86,7 +86,7 @@ def normalize_config(ctx, config): return new_config new_config = {} - for role, role_config in config.iteritems(): + for role, role_config in config.items(): if role_config is None: role_config = CONFIG_DEFAULT if '.' in role: @@ -129,7 +129,7 @@ def normalize_and_apply_overrides(ctx, config, overrides): # (e.g. 'branch: foo' is overridden with 'tag: bar'). To be able to # use deep_merge(), drop all version keys from the original config if # the corresponding override has a version key. - for role, role_config in config.iteritems(): + for role, role_config in config.items(): if (role in overrides and any(k in overrides[role] for k in VERSION_KEYS)): for k in VERSION_KEYS: @@ -147,7 +147,7 @@ def validate_config(ctx, config): :param ctx: Context :param config: Configuration """ - for _, roles_for_host in ctx.cluster.remotes.iteritems(): + for _, roles_for_host in ctx.cluster.remotes.items(): kernel = None for role in roles_for_host: role_kernel = config.get(role, kernel) @@ -307,7 +307,7 @@ def download_kernel(ctx, config): :param config: Configuration """ procs = {} - for role, src in config.iteritems(): + for role, src in config.items(): needs_download = False if src == 'distro': @@ -416,7 +416,7 @@ def download_kernel(ctx, config): wait=False) procs[role_remote.name] = proc - for name, proc in procs.iteritems(): + for name, proc in procs.items(): log.debug('Waiting for download/copy to %s to complete...', name) proc.wait() @@ -491,7 +491,7 @@ def install_and_reboot(ctx, config): """ procs = {} kernel_title = '' - for role, src in config.iteritems(): + for role, src in config.items(): (role_remote,) = ctx.cluster.only(role).remotes.keys() if isinstance(src, str) and src.find('distro') >= 0: log.info('Installing distro kernel on {role}...'.format(role=role)) @@ -632,7 +632,7 @@ def install_and_reboot(ctx, config): ) procs[role_remote.name] = proc - for name, proc in procs.iteritems(): + for name, proc in procs.items(): log.debug('Waiting for install on %s to complete...', name) proc.wait() @@ -645,7 +645,7 @@ def enable_disable_kdb(ctx, config): :param ctx: Context :param config: Configuration """ - for role, enable in config.iteritems(): + for role, enable in config.items(): (role_remote,) = ctx.cluster.only(role).remotes.keys() if "mira" in role_remote.name: serialdev = "ttyS2" @@ -1229,7 +1229,7 @@ def task(ctx, config): remove_old_kernels(ctx) - for role, role_config in config.iteritems(): + for role, role_config in config.items(): # gather information about this remote (role_remote,) = ctx.cluster.only(role).remotes.keys() system_type = role_remote.os.name diff --git a/teuthology/task/loop.py b/teuthology/task/loop.py index 1fa0152a0..cd48df1cc 100644 --- a/teuthology/task/loop.py +++ b/teuthology/task/loop.py @@ -29,7 +29,7 @@ def task(ctx, config): for entry in config.get('body', []): if not isinstance(entry, dict): entry = ctx.config.get(entry, {}) - ((taskname, confg),) = entry.iteritems() + ((taskname, confg),) = entry.items() log.info('In sequential, running task %s...' % taskname) mgr = run_tasks.run_one_task(taskname, ctx=ctx, config=confg) if hasattr(mgr, '__enter__'): diff --git a/teuthology/task/parallel.py b/teuthology/task/parallel.py index d96391a5e..6999c0aae 100644 --- a/teuthology/task/parallel.py +++ b/teuthology/task/parallel.py @@ -52,7 +52,7 @@ def task(ctx, config): # support the usual list syntax for tasks if isinstance(entry, list): entry = dict(sequential=entry) - ((taskname, confg),) = entry.iteritems() + ((taskname, confg),) = entry.items() p.spawn(_run_spawned, ctx, confg, taskname) diff --git a/teuthology/task/parallel_example.py b/teuthology/task/parallel_example.py index f39a09c79..c1915201e 100644 --- a/teuthology/task/parallel_example.py +++ b/teuthology/task/parallel_example.py @@ -31,7 +31,7 @@ def parallel_test(ctx, config): """Call run for each remote host, but use 'wait=False' to have it return immediately.""" proc = remote.run(args=['sleep', '5', run.Raw(';'), 'date', run.Raw(';'), 'hostname'], wait=False,) nodes[remote.name] = proc - for name, proc in nodes.iteritems(): + for name, proc in nodes.items(): """Wait for each process to finish before yielding and allowing other contextmanagers to run.""" proc.wait() yield diff --git a/teuthology/task/pexec.py b/teuthology/task/pexec.py index 742ac0010..573866c92 100644 --- a/teuthology/task/pexec.py +++ b/teuthology/task/pexec.py @@ -71,11 +71,11 @@ def _generate_remotes(ctx, config): (remote,) = ctx.cluster.only('client.{r}'.format(r=role)).remotes.iterkeys() yield (remote, ls) del config['clients'] - for role, ls in config.iteritems(): + for role, ls in config.items(): (remote,) = ctx.cluster.only(role).remotes.iterkeys() yield (remote, ls) else: - for role, ls in config.iteritems(): + for role, ls in config.items(): (remote,) = ctx.cluster.only(role).remotes.iterkeys() yield (remote, ls) diff --git a/teuthology/task/selinux.py b/teuthology/task/selinux.py index 767037c61..7fb799274 100644 --- a/teuthology/task/selinux.py +++ b/teuthology/task/selinux.py @@ -49,7 +49,7 @@ class SELinux(Task): """ super(SELinux, self).filter_hosts() new_cluster = Cluster() - for (remote, roles) in self.cluster.remotes.iteritems(): + for (remote, roles) in self.cluster.remotes.items(): if remote.is_vm: msg = "Excluding {host}: VMs are not yet supported" log.info(msg.format(host=remote.shortname)) diff --git a/teuthology/task/sequential.py b/teuthology/task/sequential.py index ad37108d0..2414336fe 100644 --- a/teuthology/task/sequential.py +++ b/teuthology/task/sequential.py @@ -42,7 +42,7 @@ def task(ctx, config): for entry in config: if not isinstance(entry, dict): entry = ctx.config.get(entry, {}) - ((taskname, confg),) = entry.iteritems() + ((taskname, confg),) = entry.items() log.info('In sequential, running task %s...' % taskname) mgr = run_tasks.run_one_task(taskname, ctx=ctx, config=confg) if hasattr(mgr, '__enter__'): diff --git a/teuthology/test/task/test_pcp.py b/teuthology/test/task/test_pcp.py index 3e761e616..1331be044 100644 --- a/teuthology/test/task/test_pcp.py +++ b/teuthology/test/task/test_pcp.py @@ -210,7 +210,7 @@ class TestGraphiteGrapher(TestPCPGrapher): 'foo.bar baz': 'foo.bar_baz', 'foo.*.bar baz': 'foo._all_.bar_baz', } - for in_, out in sanitized_metrics.iteritems(): + for in_, out in sanitized_metrics.items(): assert self.klass._sanitize_metric_name(in_) == out def test_get_target_globs(self): -- 2.47.3