Flake8 support

Signed-off-by: Michal Čihař <michal@cihar.com>
Move lint build to the top

Signed-off-by: Michal Čihař <michal@cihar.com>
Do not reuse variable from outer scope

Signed-off-by: Michal Čihař <michal@cihar.com>
Run pyflakes in lint mode as well

We exclude some files from it as there is no way to make them compliant:

- __init__.py need to import test/model classes for Django to discover
  them
- the settings modules need to share most of the settings

Signed-off-by: Michal Čihař <michal@cihar.com>
Split out request processing

Signed-off-by: Michal Čihař <michal@cihar.com>
Split out logic to separate functions from ssh admin view

Signed-off-by: Michal Čihař <michal@cihar.com>
Factor out different methods for finding correct unit

Signed-off-by: Michal Čihař <michal@cihar.com>
Use test ([]) for condition instead of shell eval ([[]])

Signed-off-by: Michal Čihař <michal@cihar.com>