mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-07 13:52:54 +00:00
Performance improvement using in-operator on dicts
Just a small cleanup for the existing occurrences. Using the in-operator for hash lookups is faster than using .keys() http://stackoverflow.com/questions/29314269/why-do-key-in-dict-and-key-in-dict-keys-have-the-same-output
This commit is contained in:
@@ -715,22 +715,22 @@ class RHEVConn(object):
|
||||
for iface in ifaces:
|
||||
try:
|
||||
setMsg('creating host interface ' + iface['name'])
|
||||
if 'management' in iface.keys():
|
||||
if 'management' in iface:
|
||||
manageip = iface['ip']
|
||||
if 'boot_protocol' not in iface.keys():
|
||||
if 'ip' in iface.keys():
|
||||
if 'boot_protocol' not in iface:
|
||||
if 'ip' in iface:
|
||||
iface['boot_protocol'] = 'static'
|
||||
else:
|
||||
iface['boot_protocol'] = 'none'
|
||||
if 'ip' not in iface.keys():
|
||||
if 'ip' not in iface:
|
||||
iface['ip'] = ''
|
||||
if 'netmask' not in iface.keys():
|
||||
if 'netmask' not in iface:
|
||||
iface['netmask'] = ''
|
||||
if 'gateway' not in iface.keys():
|
||||
if 'gateway' not in iface:
|
||||
iface['gateway'] = ''
|
||||
|
||||
if 'network' in iface.keys():
|
||||
if 'bond' in iface.keys():
|
||||
if 'network' in iface:
|
||||
if 'bond' in iface:
|
||||
bond = []
|
||||
for slave in iface['bond']:
|
||||
bond.append(ifacelist[slave])
|
||||
|
||||
Reference in New Issue
Block a user