When using the HttpStatusCheck with a Cyrillic website, the match check was not working.
This is because by default Django represent model fields as UTF-8 unicode .
The library "content" is represented as string. (in python 2).
* Extract method `_check_content_pattern` from HttpStatusCheck `_run` method
* Add content conversion to unicode if needed
* Add unit tests for the new method
The cloudwatch check plugin needs django autocomplete light -
eventually we can use this for other plugins too (e.g. getting
the available jenkins jobs for jenkins check)
Change to not have separate check plugins and other plugin env variable,
also revert changes to the initial migration - migrations should be
created in the plugins themselves.
If a build is in progress, then every JenkinsCheck was marked as failed.
Here we fetch the last_completed build, instead of the last_build,
because that is really what we are interested in, and we are not
relying on last_build to figure out whether a build is in progress.
Closes#551
We added a JenkinsConfig model to store configs (atm only editable in
django admin - to be moved to some sort of plugins options page)
If no JenkinsConfig are available, one will be created from the current
environment variables (JENKINS_URL etc)
Refactor JenkinsStatusCheck to have its own table instead of being a
proxy model. This is because we're moving to a plugin architecture
for status checks so we can't keep adding every new field to the base
model.
Currently, if there is there is no Jenkins job matching
the Cabot check, the check always succeeds.
This is particularly bad when jobs are renamed on Jenkins,
as Cabot stops monitoring it and never alerts on this.
Although Cabot is currently very relaxed when dealing with
Jenkins errors, since 94dcdf9 Cabot did fail on missing job.
This must have stopped working following a Jenkins API change.
Here, we catch the `jenkinsapi` `UnknownJob` exception and
set `status_code` to the value expected by the `run` method.
Also add a unit-test for that behaviour.
This is a quick fix ; but in general the entire run method
may need refactoring to not use `status_code` anymore,
We may want to consider dealiing with the `jenkinsapi` exceptions
in the `run` method rather than catching them in `get_job_status`
and setting the `status_code`.
Closes#537