mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-10-12 03:14:24 -07:00
Replace .iteritems() with six.iteritems()
Replace .iteritems() with six.iteritems() everywhere except in module_utils (because there's no 'six' on the remote host). And except in lib/ansible/galaxy/data/metadata_template.j2, because I'm not sure six is available there.
This commit is contained in:
parent
9e1bc434c7
commit
823677b490
28 changed files with 81 additions and 41 deletions
|
@ -72,6 +72,8 @@ try:
|
|||
except ImportError:
|
||||
import simplejson as json
|
||||
|
||||
from six import iteritems
|
||||
|
||||
# NOTE -- this file assumes Ansible is being accessed FROM the cobbler
|
||||
# server, so it does not attempt to login with a username and password.
|
||||
# this will be addressed in a future version of this script.
|
||||
|
@ -171,7 +173,7 @@ class CobblerInventory(object):
|
|||
interfaces = host['interfaces']
|
||||
# hostname is often empty for non-static IP hosts
|
||||
if dns_name == '':
|
||||
for (iname, ivalue) in interfaces.iteritems():
|
||||
for (iname, ivalue) in iteritems(interfaces):
|
||||
if ivalue['management'] or not ivalue['static']:
|
||||
this_dns_name = ivalue.get('dns_name', None)
|
||||
if this_dns_name is not None and this_dns_name is not "":
|
||||
|
@ -203,7 +205,7 @@ class CobblerInventory(object):
|
|||
|
||||
self.cache[dns_name] = host
|
||||
if "ks_meta" in host:
|
||||
for key, value in host["ks_meta"].iteritems():
|
||||
for key, value in iteritems(host["ks_meta"]):
|
||||
self.cache[dns_name][key] = value
|
||||
|
||||
self.write_to_cache(self.cache, self.cache_path_cache)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue