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
This commit is contained in:
sonu.kumar 2015-07-20 18:24:07 +05:30
parent 884d3613af
commit 1a71bb6790
2 changed files with 6 additions and 6 deletions

View File

@ -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]

View File

@ -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: