705 Commits

Author SHA1 Message Date
Frank Hamand
2824c246a4 0.11.13 0.11.13 2018-05-23 11:50:23 +01:00
Frank Hamand
6dd06e8dd0 Fix jenkinscheck not populating consecutive_failures
Jenkins checks were always passing due to a bug in 0.11.12
2018-05-23 11:49:33 +01:00
Frank Hamand
a938fe00a2 Update changes 2018-05-23 11:15:32 +01:00
Frank Hamand
e02856d8da
Merge pull request #617 from hartwork/reduce-branding
Reduce branding a bit?
2018-05-10 12:29:03 +01:00
Frank Hamand
73bbe63b5e
Merge pull request #615 from hartwork/serve-root-favicon.ico
Serve /favicon.ico resembling current arachnys/img/icon_*x*.png files
2018-05-10 10:18:12 +01:00
Frank Hamand
58b69f02a0
Merge pull request #625 from hartwork/issue-624-fix-404-page-for-anonymous-user
Fix 404 page for anonymous user
2018-05-10 10:16:22 +01:00
Sebastian Pipping
fd66a8647f Fix 404 page for anonymous user (fixes #624)
The anonymous user has ID `None`.  Previously, this exception was raised:
NoReverseMatch: Reverse for 'user-profile' with arguments '(None,)' not found. 1 pattern(s) tried: ['user/(?P<pk>\\d+)/profile/$']
2018-05-10 01:15:42 +02:00
Sebastian Pipping
5bf70c9793 tests_basic: Cover /favicon.ico 2018-05-10 01:02:11 +02:00
Sebastian Pipping
c5ede5e77b Ensure that .collectstatic/arachnys/img/favicon.ico exists during testing 2018-05-10 01:02:11 +02:00
Sebastian Pipping
6e063824d3 Serve /favicon.ico resembling current arachnys/img/icon_*x*.png files
One of the effects is that you don't get this Django error e-mail any more:
> ```
> [Django] ERROR: "GET /favicon.ico HTTP/1.0" 500 106
> ```

`.ico` was auto-created as following:
```
$ ( cd cabot/static/arachnys/img && convert icon_*x*.png favicon.ico && file favicon.ico )
favicon.ico: MS Windows icon resource - 2 icons, 48x48, 32 bits/pixel, 96x96, 32 bits/pixel
```
2018-05-09 18:25:26 +02:00
Frank Hamand
2c8bb9d9af Update changes 2018-04-23 11:50:27 +01:00
Frank Hamand
2ab96556bc Change multi_line_output mode to 0 for consistency with existing code 2018-04-23 10:31:44 +01:00
Frank Hamand
68f826f7f5 Change default section to third party instead of manual 2018-04-23 10:31:44 +01:00
Frank Hamand
e09ec7a15d
Merge pull request #561 from arachnys/isort-config
Add isort configuration to sort imports
2018-04-23 11:30:41 +02:00
Frank Hamand
c62ab99337 Update changes 2018-04-23 10:27:31 +01:00
Sebastian Pipping
dd1360c77d Reduce branding a bit 2018-04-22 18:03:53 +02:00
David Buxton
36d63a5de2
Merge pull request #616 from hartwork/fix-order-public-services-listing
Make public services listing list in case insensitive order
2018-04-22 12:32:48 +01:00
Sebastian Pipping
82c64d3f2b Make public services listing list in case insensitive order 2018-04-22 02:25:31 +02:00
Frank Hamand
241096408b
Merge pull request #614 from hartwork/issue-608-approach-django-bootstrap-form
Style forms using django-bootstrap-form 3.4
2018-04-20 15:50:06 +02:00
Sebastian Pipping
21454d000c Style forms using django-bootstrap-form 3.4 (#608)
Potentially one of the least invasive approaches to apply Bootstrap3 styling.

Project home:
- https://github.com/tzangms/django-bootstrap-form
- https://pypi.org/project/django-bootstrap-form/
2018-04-20 01:23:31 +02:00
David Buxton
71b32a2d0a
Merge pull request #610 from hartwork/issue-607-fix-http-check
Fix HTTP check for websites serving non-UTF-8 content
2018-04-18 22:08:31 +01:00
Sebastian Pipping
0b92e49aae Store unicode reply for HTTP checks (#607)
Django would try convert to unicode when saving the
raw_data TextField.  So we save time and potential trouble
with non-standard encodings.

Docs:
https://docs.djangoproject.com/en/1.11/ref/unicode/#models
2018-04-18 22:54:27 +02:00
Sebastian Pipping
3659692211 Fix HTTP check for websites serving non-UTF-8 content (#607)
Response.content is of type `str` and needs decoding.
In contrast, Response.text is of type `unicode`, already.
This way, we no longer need to mis-assume UTF-8.

Docs:
http://docs.python-requests.org/en/master/user/quickstart/#response-content
2018-04-18 22:54:24 +02:00
David Buxton
3aa95667d7 Add test to check that failures properly tagged on HttpCheck (#607) 2018-04-18 22:54:21 +02:00
David Buxton
8a2cab5786 Create mocks for text in addition to content (#607) 2018-04-18 22:54:21 +02:00
David Buxton
a9dc61cd39
Merge pull request #590 from davidjb/patch-1
Cabot sends `None` string in HTTP status checks in auth header for username or password
2018-04-17 10:52:14 +01:00
David Beitey
bca6ee150c Pass empty auth strs to requests instead of None
This solves / works around
https://github.com/requests/requests/issues/4465 until that behaviour is
made explicit or otherwise resolved.
2018-04-17 18:58:58 +10:00
David Buxton
9ba585dfd9
Merge pull request #609 from hartwork/issue-605-prevent-http-check-auth-autofill
Prevent auto-fill of saved credentials into HTTP auth fields
2018-04-17 08:02:00 +01:00
Sebastian Pipping
69a65d3409 Prevent auto-fill of saved credentials into HTTP auth fields (issue #605)
Tried with Firefox 58, Chromium 63, Chrome 66.
2018-04-16 23:15:00 +02:00
David Buxton
b5844aa446
Merge pull request #606 from hartwork/fix-menu-lack-spacing
Fix lack of spacing in far right user dropdown menu
2018-04-16 08:59:36 +01:00
David Buxton
570b7049d8
Merge pull request #604 from hartwork/fix-http-spelling
Fix spelling of "Http" to "HTTP"
2018-04-16 08:56:13 +01:00
Sebastian Pipping
067d36afba menu: Add missing space between icon and label
Affected items:
* Profile settings
* Plugin settings
2018-04-16 01:07:25 +02:00
Sebastian Pipping
d5da2c0f52 Fix spelling of "Http" to "HTTP" 2018-04-16 00:59:05 +02:00
Sebastian Pipping
1b1c0eddc3 views.py: Fix flake8 issue
cabot/cabotapp/views.py:1013:5: E301 expected 1 blank line, found 0
2018-04-16 00:59:05 +02:00
Frank Hamand
20fada0aff 0.11.12 0.11.12 2018-03-21 11:22:36 +00:00
Frank Hamand
fd2befbf33 Update changelog 2018-03-21 11:22:35 +00:00
Jean-Fred Berthelot
9c3f4f9161 Debounce JenkinsCheck on the number of job failures
Debounce is “the number of successive failures
permitted before check will be marked as failed”.
It is very useful to avoid alerts on expected hiccups.

For checks whose retry logic lies in Cabot using `frequency`
(which is the case for Graphite, HTTP, and ICMP checks),
it makes sense that the debounce is about how often Cabot retried things.

For JenkinsChecks, however, we have no control over
how often Cabot checks the job. This means that even a
debounce of eg 5 can trigger an alert over 1 job failure.

A simpler implementation of this was to loop over the
recent results, count how many distinct jobs have failed,
(using the job number stored in the `status_check_result`),
and set the status to fail if this is higher than the debounce.
However, Cabot only considers the last 10 results (hardcoded value).
Since Cabot checks the job at fairly high frequency (or at least a
frequency higher than the Jenkins run frequency), this can mean
the status would switch to pass after 10 checks of a single check failure.

We thus need to enrich the StatusCheckResult data model
to store that information.

- Add field `consecutive_failures` to StatusCheckResult model
  (and associated migration).

- Retrieve from Jenkins the last good build, and compute from
  that the number of consecutive failures

- Also display the consecutive failures in the Check results page

Closes #537
2018-03-21 11:22:35 +00:00
Jean-Fred Berthelot
337e359130 Add unit tests for Jenkins
Add unit tests covering
- when there is no build of the job at all
- when there is no good build (ie, only failing builds)
2018-03-21 10:59:51 +00:00
Jean-Fred Berthelot
cbb3be5093 Move calculate_debounced_passing as StatusCheck method
We want to override `calculate_debounced_passing` for the JenkinsCheck.
2018-03-21 10:59:51 +00:00
Jean-Fred Berthelot
f2dfb21f2b Bump Django to 1.11.11
There are vulnerabilities for the intermediate versions.

Changelog: https://docs.djangoproject.com/en/2.0/releases/#id1
2018-03-21 10:59:51 +00:00
Frank Hamand
535e14463b 0.11.11 0.11.11 2018-03-09 17:12:32 +00:00
Frank Hamand
9a4a44a9fc Fix /api/oncall endpoint not working with basic auth 2018-03-09 17:12:16 +00:00
Frank Hamand
f6fd5aba03 0.11.10 0.11.10 2018-03-09 15:10:44 +00:00
Frank Hamand
ccadade420 Remove redundant python requirement
This was installed by django ldap anyway, and the version was clashing
2018-03-09 15:10:44 +00:00
Frank Hamand
e935cb9082 Add /api/oncall endpoint
A new endpoint to return the currently on call users

Also added a serialize method to plugins to allow plugin data (e.g.
slack alias) to get returned with the method.
2018-03-09 15:10:44 +00:00
Frank Hamand
b5dca88ef9 0.11.9 2018-03-09 15:10:43 +00:00
Frank Hamand
b1bc576595 Fix issue where Jenkins variables were required on first launch 2017-11-22 09:58:36 +00:00
Jean-Frédéric
ead3f98487
Pass-through SOCIAL_AUTH_REDIRECT_IS_HTTPS from environment variables (#578)
This is needed when running behind a reverse proxy,
otherwise we get redirected to plain HTTP which does
not match the expected URL in the provider.

Per the python-social-auth documentation:
```
On projects behind a reverse proxy that uses HTTPS, the redirect
URIs can have the wrong schema (http:// instead of https://) if
the request lacks the appropriate headers, which might cause
errors during the auth process.
To force HTTPS in the final URIs set this setting to True
```
https://python-social-auth-docs.readthedocs.io/en/latest/configuration/settings.html
2017-11-10 10:57:00 +00:00
Jean-Fred Berthelot
7baede72a6 Ignore Flake8 E722
E722 is "do not use bare except", of which we have four violations
in `models/base.py`.

Let's ignore these for now to get the build working again.
2017-11-09 15:01:38 +00:00
Jean-Fred Berthelot
af66cc806d Add test for graphite.parse_metric when exception is raised
Add test for when the API call to Graphite throws an exception.
2017-10-17 17:45:07 +01:00