From 1a71bb6790128456b86ed9f675cc17e294bb8fc0 Mon Sep 17 00:00:00 2001 From: "sonu.kumar" Date: Mon, 20 Jul 2015 18:24:07 +0530 Subject: [PATCH] Replacing dict.iteritems() with dict.items() dict.iteritems() of python 2.x has been replaced with dict.items() of python 3.x to provide compatibility with both i.e python 2 as well as python 3. Change-Id: If4611f04cc676a2b47f0fe6f646c2823cb0c4289 --- contrib/archive/backends/impl_ipa/__init__.py | 4 ++-- contrib/ipaextractor.py | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/contrib/archive/backends/impl_ipa/__init__.py b/contrib/archive/backends/impl_ipa/__init__.py index 208ee426..9c193728 100644 --- a/contrib/archive/backends/impl_ipa/__init__.py +++ b/contrib/archive/backends/impl_ipa/__init__.py @@ -225,7 +225,7 @@ class IPABackend(base.Backend): args = {'idnssoamname': servers[0]['name']} if self.force: args['force'] = True - for dkey, ipakey in domain2ipa.iteritems(): + for dkey, ipakey in list(domain2ipa.items()): if dkey in domain: args[ipakey] = domain[dkey] ipareq['params'] = [params, args] @@ -245,7 +245,7 @@ class IPABackend(base.Backend): ipareq = {'method': 'dnszone_mod', 'id': 0} params = [domain['name']] args = {} - for dkey, ipakey in domain2ipa.iteritems(): + for dkey, ipakey in list(domain2ipa.items()): if dkey in domain: args[ipakey] = domain[dkey] ipareq['params'] = [params, args] diff --git a/contrib/ipaextractor.py b/contrib/ipaextractor.py index 0658d74d..f5d3a715 100644 --- a/contrib/ipaextractor.py +++ b/contrib/ipaextractor.py @@ -79,7 +79,7 @@ class CannotUseIPABackend(Exception): # create mapping of ipa record types to designate types iparectype2designate = {} -for rectype, tup in impl_ipa.rectype2iparectype.iteritems(): +for rectype, tup in list(impl_ipa.rectype2iparectype.items()): iparectype = tup[0] iparectype2designate[iparectype] = rectype @@ -195,7 +195,7 @@ def syncipaservers2des(servers, designatereq, designateurl): (server, pprint.pformat(resp.json()))) # next - delete servers in designate not in ipa - for server, sid in dservers.iteritems(): + for server, sid in list(dservers.items()): if server not in servers: delresp = designatereq.delete(srvurl + "/" + sid) if delresp.status_code == 200: @@ -252,7 +252,7 @@ def main(): zrec['idnszoneactive'][0] == 'TRUE': # ipa returns every data field as a list # convert the list to a scalar - for n, v in zrec.iteritems(): + for n, v in list(zrec.items()): if n in zoneskips: continue if isinstance(v, list): @@ -345,7 +345,7 @@ def main(): zonerecs[desreq['name']] = resp.json()['id'] # get the records for each zone - for zonename, domainid in zonerecs.iteritems(): + for zonename, domainid in list(zonerecs.items()): recurl = designateurl + "/domains/" + domainid + "/records" iparecs = getiparecords(ipabackend, zonename, version) for rec in iparecs: