Skip to content

Commit

Permalink
[RemoveAll] Go on removing crashlogs even if one of them was failed
Browse files Browse the repository at this point in the history
to be deleted.
  • Loading branch information
noxiouz committed Jul 30, 2015
1 parent 134ad3f commit b1c4615
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions cocaine/tools/actions/crashlog.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

from tornado import gen

from cocaine.tools import actions
from cocaine.tools import actions, log
from cocaine.decorators import coroutine
from cocaine.tools.actions import app

Expand Down Expand Up @@ -68,9 +68,9 @@ class View(Specific):
def execute(self):
channel = yield self.storage.find('crashlogs', [self.name])
crashlogs = yield channel.rx.get()
parsedCrashlogs = _parseCrashlogs(crashlogs, timestamp=self.timestamp)
parsed_crashlogs = _parseCrashlogs(crashlogs, timestamp=self.timestamp)
contents = []
for crashlog in parsedCrashlogs:
for crashlog in parsed_crashlogs:
key = '%s:%s' % (crashlog[0], crashlog[2])
channel = yield self.storage.read('crashlogs', key)
content = yield channel.rx.get()
Expand All @@ -83,11 +83,14 @@ class Remove(Specific):
def execute(self):
channel = yield self.storage.find('crashlogs', [self.name])
crashlogs = yield channel.rx.get()
parsedCrashlogs = _parseCrashlogs(crashlogs, timestamp=self.timestamp)
for crashlog in parsedCrashlogs:
key = '%s:%s' % (crashlog[0], crashlog[2])
channel = yield self.storage.remove('crashlogs', key)
yield channel.rx.get()
parsed_crashlogs = _parseCrashlogs(crashlogs, timestamp=self.timestamp)
for crashlog in parsed_crashlogs:
try:
key = '%s:%s' % (crashlog[0], crashlog[2])
channel = yield self.storage.remove('crashlogs', key)
yield channel.rx.get()
except Exception as err:
log.error("unable to delete crashlog %s: %s", str(crashlog), err)
raise gen.Return('Done')


Expand Down

0 comments on commit b1c4615

Please sign in to comment.