Skip to content

Commit

Permalink
don't delete an item while iterating over the list. related: emre#51
Browse files Browse the repository at this point in the history
  • Loading branch information
emre committed Apr 22, 2014
1 parent 5fedbf4 commit d59ad43
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions storm/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,12 @@ def list_entries(self, order=False, only_servers=False):

# required for the web api.
if only_servers:
new_config_data = []
for index, value in enumerate(config_data):
print(value)
if value.get('type') and value.get("type") != 'entry' or value.get("host") == '*':
del config_data[index]
if value.get("type") == 'entry' and value.get("host") != '*':
new_config_data.append(value)

config_data = new_config_data

if order:
config_data = sorted(config_data, key=itemgetter("host"))
Expand Down

0 comments on commit d59ad43

Please sign in to comment.