Replace six.iteritems() with .items()
We should avoid using six.iteritems/keys achieve iterators. We can use dict.items/keys instead, as it wil l return iterators in PY3 as well. And dict.items/keys will more readable. In py2, the performance about list should be negligible, see https://wiki.openstack.org/wiki/Python3 and http://lists.openstack.org/pipermail/openstack-dev/2015-June/066391.html Change-Id: I6f8ee2ed36ed94e2ef8347463f56eed44464a605
This commit is contained in:
parent
1e90530e40
commit
9629270987
@ -114,7 +114,6 @@ intended to support specific host queries.
|
|||||||
import csv
|
import csv
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
import six
|
|
||||||
import sys
|
import sys
|
||||||
import yaml
|
import yaml
|
||||||
|
|
||||||
@ -329,7 +328,7 @@ def _process_shade(groups, hostvars):
|
|||||||
else:
|
else:
|
||||||
name = machine['name']
|
name = machine['name']
|
||||||
new_machine = {}
|
new_machine = {}
|
||||||
for key, value in six.iteritems(machine):
|
for key, value in machine.items():
|
||||||
# NOTE(TheJulia): We don't want to pass infomrational links
|
# NOTE(TheJulia): We don't want to pass infomrational links
|
||||||
# nor do we want to pass links about the ports since they
|
# nor do we want to pass links about the ports since they
|
||||||
# are API endpoint URLs.
|
# are API endpoint URLs.
|
||||||
|
@ -22,8 +22,6 @@ try:
|
|||||||
except ImportError:
|
except ImportError:
|
||||||
HAS_SHADE = False
|
HAS_SHADE = False
|
||||||
|
|
||||||
import six
|
|
||||||
|
|
||||||
DOCUMENTATION = '''
|
DOCUMENTATION = '''
|
||||||
---
|
---
|
||||||
module: os_ironic_facts
|
module: os_ironic_facts
|
||||||
@ -117,7 +115,7 @@ def main():
|
|||||||
new_driver_info = dict()
|
new_driver_info = dict()
|
||||||
# Rebuild driver_info to remove any password values
|
# Rebuild driver_info to remove any password values
|
||||||
# as they will be masked.
|
# as they will be masked.
|
||||||
for key, value in six.iteritems(facts['driver_info']):
|
for key, value in facts['driver_info'].items():
|
||||||
if 'password' not in key:
|
if 'password' not in key:
|
||||||
new_driver_info[key] = value
|
new_driver_info[key] = value
|
||||||
if new_driver_info:
|
if new_driver_info:
|
||||||
|
Loading…
Reference in New Issue
Block a user