diff --git a/lib/ansible/modules/extras/cloud/misc/virt_net.py b/lib/ansible/modules/extras/cloud/misc/virt_net.py index 3622d455e48..30d796b711f 100644 --- a/lib/ansible/modules/extras/cloud/misc/virt_net.py +++ b/lib/ansible/modules/extras/cloud/misc/virt_net.py @@ -317,18 +317,13 @@ class VirtNetwork(object): return self.conn.find_entry(entryid) def list_nets(self, state=None): - entries = self.conn.find_entry(-1) results = [] - for x in entries: - try: - if state: - entrystate = self.conn.get_status2(x) - if entrystate == state: - results.append(x.name()) - else: - results.append(x.name()) - except: - pass + for entry in self.conn.find_entry(-1): + if state: + if state == self.conn.get_status2(entry): + results.append(entry.name()) + else: + results.append(entry.name()) return results def state(self):