Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAleksey Lim <alsroot@sugarlabs.org>2013-09-01 11:52:13 (GMT)
committer Aleksey Lim <alsroot@sugarlabs.org>2013-09-01 11:52:13 (GMT)
commit81d8f05afa42a7462e1b95561ccc6420dfc947c6 (patch)
tree77b1916d8a7dc76ed1c1e2096e3da0f08295eb9b
parent3a25ef7048e6e1a8a7654c14debbc96d2667aed9 (diff)
Submit system logs on all errors for clone and launch API routes
-rw-r--r--sugar_network/client/implementations.py13
-rwxr-xr-xtests/units/client/offline_routes.py20
-rwxr-xr-xtests/units/client/online_routes.py20
3 files changed, 43 insertions, 10 deletions
diff --git a/sugar_network/client/implementations.py b/sugar_network/client/implementations.py
index 84c5128..2681592 100644
--- a/sugar_network/client/implementations.py
+++ b/sugar_network/client/implementations.py
@@ -169,6 +169,12 @@ class Routes(object):
stability = request.get('stability') or \
client.stability(request.guid)
+ request.session['stability'] = stability
+ request.session['logs'] = [
+ client.profile_path('logs', 'shell.log'),
+ client.profile_path('logs', 'sugar-network-client.log'),
+ ]
+
_logger.debug('Solving %r stability=%r', request.guid, stability)
if 'activity' not in context['type']:
@@ -190,7 +196,6 @@ class Routes(object):
solution = self._map_exceptions(solver.solve,
self.fallback, request.guid, stability)
request.session['solution'] = solution
- request.session['stability'] = stability
return solution[0]
def _checkin_impl(self, context, request, sel):
@@ -349,11 +354,7 @@ def _exec(context, request, sel):
request.session['args'] = args
log_path = toolkit.unique_filename(logdir, context.guid + '.log')
- request.session['logs'] = [
- join(logdir, 'shell.log'),
- join(logdir, 'sugar-network-client.log'),
- log_path,
- ]
+ request.session['logs'].append(log_path)
child = coroutine.fork()
if child is not None:
diff --git a/tests/units/client/offline_routes.py b/tests/units/client/offline_routes.py
index 7c98ed0..4eae0ce 100755
--- a/tests/units/client/offline_routes.py
+++ b/tests/units/client/offline_routes.py
@@ -328,7 +328,13 @@ class OfflineRoutes(tests.Test):
})
self.assertEqual([
{'event': 'launch', 'activity_id': 'activity_id'},
- {'event': 'failure', 'activity_id': 'activity_id', 'exception': 'ServiceUnavailable', 'error': """\
+ {'event': 'failure', 'activity_id': 'activity_id', 'exception': 'ServiceUnavailable',
+ 'stability': ['stable'],
+ 'logs': [
+ tests.tmpdir + '/.sugar/default/logs/shell.log',
+ tests.tmpdir + '/.sugar/default/logs/sugar-network-client.log',
+ ],
+ 'error': """\
Can't find all required implementations:
- %s -> (problem)
No known implementations at all""" % context},
@@ -351,7 +357,13 @@ Can't find all required implementations:
}})
self.assertEqual([
{'event': 'launch', 'activity_id': 'activity_id'},
- {'event': 'failure', 'activity_id': 'activity_id', 'exception': 'ServiceUnavailable', 'error': """\
+ {'event': 'failure', 'activity_id': 'activity_id', 'exception': 'ServiceUnavailable',
+ 'stability': ['stable'],
+ 'logs': [
+ tests.tmpdir + '/.sugar/default/logs/shell.log',
+ tests.tmpdir + '/.sugar/default/logs/sugar-network-client.log',
+ ],
+ 'error': """\
Can't find all required implementations:
- %s -> 1 (%s)
- dep -> (problem)
@@ -421,6 +433,10 @@ Can't find all required implementations:
'version': '0',
},
],
+ 'logs': [
+ tests.tmpdir + '/.sugar/default/logs/shell.log',
+ tests.tmpdir + '/.sugar/default/logs/sugar-network-client.log',
+ ],
},
],
[i for i in ipc.get(['context', context], cmd='launch')])
diff --git a/tests/units/client/online_routes.py b/tests/units/client/online_routes.py
index de9f3f4..b06a824 100755
--- a/tests/units/client/online_routes.py
+++ b/tests/units/client/online_routes.py
@@ -381,7 +381,13 @@ class OnlineRoutes(tests.Test):
})
self.assertEqual([
- {'event': 'failure', 'exception': 'NotFound', 'error': """\
+ {'event': 'failure', 'exception': 'NotFound',
+ 'stability': ['stable'],
+ 'logs': [
+ tests.tmpdir + '/.sugar/default/logs/shell.log',
+ tests.tmpdir + '/.sugar/default/logs/sugar-network-client.log',
+ ],
+ 'error': """\
Can't find all required implementations:
- %s -> (problem)
No known implementations at all""" % context},
@@ -413,6 +419,10 @@ Can't find all required implementations:
self.assertEqual([
{'event': 'failure', 'exception': 'NotFound', 'error': 'BLOB does not exist',
'stability': ['stable'],
+ 'logs': [
+ tests.tmpdir + '/.sugar/default/logs/shell.log',
+ tests.tmpdir + '/.sugar/default/logs/sugar-network-client.log',
+ ],
'solution': [{
'command': ['echo'],
'context': context,
@@ -952,7 +962,13 @@ Can't find all required implementations:
})
self.assertEqual([
{'event': 'launch', 'activity_id': 'activity_id', 'foo': 'bar', 'activity_id': 'activity_id'},
- {'event': 'failure', 'activity_id': 'activity_id', 'exception': 'NotFound', 'error': """\
+ {'event': 'failure', 'activity_id': 'activity_id', 'exception': 'NotFound',
+ 'stability': ['stable'],
+ 'logs': [
+ tests.tmpdir + '/.sugar/default/logs/shell.log',
+ tests.tmpdir + '/.sugar/default/logs/sugar-network-client.log',
+ ],
+ 'error': """\
Can't find all required implementations:
- bundle_id -> (problem)
No known implementations at all"""},