diff options
author | Kirill Yakovenko <kirill.yakovenko@gmail.com> | 2016-11-01 22:45:49 +0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-11-01 22:45:49 +0700 |
commit | d1e883ceb9272e0cb9c26801a706da12f1cebb6a (patch) | |
tree | b7bc1c3a9b5ac46ae15ff373d2c896a9e2efd409 /omaha_server/crash | |
parent | b2907055db8037ef0701fc10b5a0fb865fd82afd (diff) | |
parent | 9e468645314a1a9f5108e492fc0906b52638964f (diff) | |
download | omaha-server-master.zip omaha-server-master.tar.gz omaha-server-master.tar.bz2 |
Merge pull request #230 from Crystalnix/devHEADorigin/masterorigin/HEADmaster
Sortable columns, PATCH request for versions, Hotfixs
Diffstat (limited to 'omaha_server/crash')
-rw-r--r-- | omaha_server/crash/models.py | 18 | ||||
-rw-r--r-- | omaha_server/crash/serializers.py | 3 | ||||
-rw-r--r-- | omaha_server/crash/tests/test_serializers.py | 5 | ||||
-rw-r--r-- | omaha_server/crash/utils.py | 6 |
4 files changed, 24 insertions, 8 deletions
diff --git a/omaha_server/crash/models.py b/omaha_server/crash/models.py index 434b26a..d7a4dd0 100644 --- a/omaha_server/crash/models.py +++ b/omaha_server/crash/models.py @@ -33,16 +33,24 @@ from omaha.models import BaseModel from crash.managers import CrashManager, SymbolsManager -def crash_upload_to(obj, filename): +def upload_to(directory, obj, filename): now = timezone.now() - return os.path.join(*map(str, ['minidump', now.year, now.month, + max_length = 255 + path = os.path.join(*map(str, [directory, now.year, now.month, now.day, uuid.uuid4(), filename])) + if len(path) > max_length: + name, ext = os.path.splitext(path) + ext_length = len(ext) + path = name[:max_length-ext_length] + ext + return path + + +def crash_upload_to(obj, filename): + return upload_to('minidump', obj, filename) def crash_archive_upload_to(obj, filename): - now = timezone.now() - return os.path.join(*map(str, ['minidump_archive', now.year, now.month, - now.day, uuid.uuid4(), filename])) + return upload_to('minidump_archive', obj, filename) class Crash(BaseModel): diff --git a/omaha_server/crash/serializers.py b/omaha_server/crash/serializers.py index 97e181f..81c714e 100644 --- a/omaha_server/crash/serializers.py +++ b/omaha_server/crash/serializers.py @@ -59,8 +59,9 @@ class SymbolsSerializer(serializers.HyperlinkedModelSerializer): class CrashSerializer(serializers.HyperlinkedModelSerializer): meta = serializers.DictField() + stacktrace_json = serializers.DictField() class Meta: model = Crash fields = ('id', 'upload_file_minidump', 'archive', 'appid', 'userid', - 'meta', 'signature', 'created', 'modified',) + 'meta', 'signature', 'stacktrace_json', 'created', 'modified',) diff --git a/omaha_server/crash/tests/test_serializers.py b/omaha_server/crash/tests/test_serializers.py index ecc8ab9..34350ec 100644 --- a/omaha_server/crash/tests/test_serializers.py +++ b/omaha_server/crash/tests/test_serializers.py @@ -74,6 +74,9 @@ class CrashSerializerTest(TestCase): lang='en', version='1.0.0.1', ) + stacktrace_json = dict( + crashing_thread={}, + ) app_id = '{D0AB2EBC-931B-4013-9FEB-C9C4C2225C8C}' user_id = '{2882CF9B-D9C2-4edb-9AAF-8ED5FCF366F7}' crash = Crash.objects.create( @@ -81,6 +84,7 @@ class CrashSerializerTest(TestCase): userid=user_id, upload_file_minidump=SimpleUploadedFile('./dump.dat', b''), meta=meta, + stacktrace_json=stacktrace_json ) self.assertDictEqual(CrashSerializer(crash).data, dict(id=crash.id, @@ -90,5 +94,6 @@ class CrashSerializerTest(TestCase): userid=str(crash.userid), meta=meta, signature=crash.signature, + stacktrace_json=crash.stacktrace_json, created=crash.created.strftime('%Y-%m-%dT%H:%M:%S.%fZ'), modified=crash.modified.strftime('%Y-%m-%dT%H:%M:%S.%fZ'))) diff --git a/omaha_server/crash/utils.py b/omaha_server/crash/utils.py index 8990722..1cceb76 100644 --- a/omaha_server/crash/utils.py +++ b/omaha_server/crash/utils.py @@ -113,13 +113,15 @@ def send_stacktrace_sentry(crash): crashdump_url=crash.upload_file_minidump.url, ) + tags = {} if crash.meta: extra.update(crash.meta) - + ver = crash.meta.get('ver') + if ver: + tags['ver'] = ver if crash.archive: extra['archive_url'] = crash.archive.url - tags = {} tags.update(stacktrace.get('system_info', {})) if crash.appid: |