1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Securize the index based lookup of dict.keys() (#54452)

This commit is contained in:
Ludovic Rivallain 2019-03-27 13:02:41 +01:00 committed by ansibot
parent 4a5b9bd8eb
commit cf2f13e05d
4 changed files with 4 additions and 4 deletions

View file

@ -114,7 +114,7 @@ class VMwareConfigurationBackup(PyVmomi):
self.module.fail_json(msg="Failed to find ESXi %s" % self.esxi_hostname)
host_system = get_all_objs(self.content, [vim.HostSystem])
return host_system.keys()[0]
return list(host_system)[0]
def process_state(self):
if self.state == 'saved':

View file

@ -108,7 +108,7 @@ def main():
host = get_all_objs(content, [vim.HostSystem])
if not host:
module.fail_json(msg="Unable to locate Physical Host.")
host_system = host.keys()[0]
host_system = list(host)[0]
changed = configure_dns(host_system, change_hostname_to, domainname, dns_servers)
module.exit_json(changed=changed)
except vmodl.RuntimeFault as runtime_fault:

View file

@ -104,7 +104,7 @@ def main():
host = get_all_objs(content, [vim.HostSystem])
if not host:
module.fail_json(msg="Unable to locate Physical Host.")
host_system = host.keys()[0]
host_system = list(host)[0]
changed = configure_vmkernel_ip_address(host_system, vmk_name, ip_address, subnet_mask)
module.exit_json(changed=changed)
except vmodl.RuntimeFault as runtime_fault:

View file

@ -108,7 +108,7 @@ def main():
host = get_all_objs(content, [vim.HostSystem])
if not host:
module.fail_json(msg="Unable to locate Physical Host.")
host_system = host.keys()[0]
host_system = list(host)[0]
changed, result, cluster_uuid = create_vsan_cluster(host_system, new_cluster_uuid)
module.exit_json(changed=changed, result=result, cluster_uuid=cluster_uuid)