Skip to content

Commit

Permalink
Merge pull request #23 from frecar/frecar/allow-custom-status-code-check
Browse files Browse the repository at this point in the history
Allow user to specify status code to check for #fixes 18
  • Loading branch information
frecar committed Jul 18, 2015
2 parents ebbfbf1 + 737260a commit 2853e11
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions django_fabric/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class App(object):
'dev': 'requirements.txt',
'prod': 'requirements.txt',
}
status_code = None
status_code = 200
virtualenv_activate = 'source venv/bin/activate'

def __init__(self, project_paths=None, project_package=None, test_settings=None, strict=False,
Expand Down Expand Up @@ -168,15 +168,14 @@ def check_status(self, instance):
if instance in self.urls:
self.notify(colors.yellow('Checking if %s is alive...' % instance))
response = requests.get(self.urls[instance]).status_code
self.status_code = response
if response != 200:
if response != self.status_code:
self.notify(colors.red('Sound the alarm, %s did noe respond correctly(%s)' % (
instance,
response
)))

self.notify(colors.green('Relax already, %s returned 200' % instance))
return response == 200
self.notify(colors.green('Relax already, %s returned %s' % (instance, response)))
return response == self.status_code
else:
self.notify(colors.yellow('I have no url for %s' % instance))
return False
Expand Down

0 comments on commit 2853e11

Please sign in to comment.