diff options
author | diosmosis <benaka@piwik.pro> | 2015-01-26 02:10:44 +0300 |
---|---|---|
committer | diosmosis <benaka@piwik.pro> | 2015-01-26 02:11:08 +0300 |
commit | a85c83be8261331bcbbb4b01a4a24d023d1b874d (patch) | |
tree | cb7edded9874b10bff6c37f8529342ec108bba9c /misc | |
parent | d43f479c95c4f379df2be81722d8a06a89e414c0 (diff) |
Fixes #6982, check result of bulk tracking request to make sure the request succeeded and fail if it does not succeed. Avoids silent failures in log importer when BulkTracking plugin is disabled.
Diffstat (limited to 'misc')
-rwxr-xr-x | misc/log-analytics/import_logs.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/misc/log-analytics/import_logs.py b/misc/log-analytics/import_logs.py index a3036dde56..1ad9654fe8 100755 --- a/misc/log-analytics/import_logs.py +++ b/misc/log-analytics/import_logs.py @@ -1457,13 +1457,20 @@ class Recorder(object): 'token_auth': config.options.piwik_token_auth, 'requests': [self._get_hit_args(hit) for hit in hits] } - piwik.call( + result = piwik.call( '/piwik.php', args={}, expected_content=None, headers={'Content-type': 'application/json'}, data=data, on_failure=self._on_tracking_failure ) + + # make sure the request succeeded and returned valid json + try: + result = json.loads(result) + except ValueError, e: + fatal_error("Incorrect response from tracking API: '%s'\nIs the BulkTracking plugin disabled?" % result) + stats.count_lines_recorded.advance(len(hits)) def _on_tracking_failure(self, response, data): |