Rewrite method to not use try/except

Additional checks are not needed, because 'self.conn.get_entry(-1)'
returns all existing entries, each one should have state defined.
reviewable/pr18780/r1
Maciej Delmanowski 9 years ago
parent 00e7e225ce
commit dc92f0af4c

@ -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:
for entry in self.conn.find_entry(-1):
if state:
entrystate = self.conn.get_status2(x)
if entrystate == state:
results.append(x.name())
if state == self.conn.get_status2(entry):
results.append(entry.name())
else:
results.append(x.name())
except:
pass
results.append(entry.name())
return results
def state(self):

Loading…
Cancel
Save