use first zone URL when checking for operationality (#6460)

Checking the base URL doesn't work for services such as Combo where the base
URL will 404 as long as no page have been added.
This commit is contained in:
Frédéric Péters 2015-02-10 11:15:05 +01:00
parent 33f03405a2
commit 0f080ad8d1
1 changed files with 3 additions and 2 deletions

View File

@ -65,10 +65,11 @@ class ServiceBase(models.Model):
once_now = now()
self.last_operational_check_timestamp = once_now
try:
fd = urllib2.urlopen(self.base_url, timeout=10)
zone = self.get_admin_zones()[0]
fd = urllib2.urlopen(zone.href, timeout=10)
fd.close()
self.last_operational_success_timestamp = once_now
except (urllib2.URLError, urllib2.HTTPError):
except (urllib2.URLError, urllib2.HTTPError), e:
pass
self.save(update_fields=('last_operational_check_timestamp', 'last_operational_success_timestamp'))