Implements: Health check with UUIDs
Change-Id: I28ba4f51ce9b4c48ff4868086ad820293f854b43
This commit is contained in:
parent
55915d47e8
commit
1a5114a448
|
@ -11,6 +11,7 @@ Tony Tan (tony.tan@rackspace.com)
|
||||||
Malini Kamalambal (malini.kamalambal@rackspace.com)
|
Malini Kamalambal (malini.kamalambal@rackspace.com)
|
||||||
Obulapathi Challa (obulapathi.challa@rackspace.com)
|
Obulapathi Challa (obulapathi.challa@rackspace.com)
|
||||||
Sriram Padmanabhan (sriram.padmanabhan@rackspace.com)
|
Sriram Padmanabhan (sriram.padmanabhan@rackspace.com)
|
||||||
|
Mohan Madhavan (mohan.madhavan@rackspace.com)
|
||||||
|
|
||||||
|
|
||||||
See also AUTHORS for a complete list of contributors.
|
See also AUTHORS for a complete list of contributors.
|
||||||
|
|
|
@ -27,6 +27,7 @@ from poppy.openstack.common import log
|
||||||
from poppy.provider.akamai import controllers
|
from poppy.provider.akamai import controllers
|
||||||
from poppy.provider.akamai.mod_san_queue import zookeeper_queue
|
from poppy.provider.akamai.mod_san_queue import zookeeper_queue
|
||||||
from poppy.provider import base
|
from poppy.provider import base
|
||||||
|
import uuid
|
||||||
|
|
||||||
LOG = log.getLogger(__name__)
|
LOG = log.getLogger(__name__)
|
||||||
|
|
||||||
|
@ -201,7 +202,7 @@ class CDNProvider(base.Driver):
|
||||||
return san_info_storage.driver
|
return san_info_storage.driver
|
||||||
|
|
||||||
def is_alive(self):
|
def is_alive(self):
|
||||||
|
unique_id = str(uuid.uuid4())
|
||||||
request_headers = {
|
request_headers = {
|
||||||
'Content-type': 'application/json',
|
'Content-type': 'application/json',
|
||||||
'Accept': 'text/plain'
|
'Accept': 'text/plain'
|
||||||
|
@ -210,12 +211,24 @@ class CDNProvider(base.Driver):
|
||||||
resp = self.policy_api_client.put(
|
resp = self.policy_api_client.put(
|
||||||
self.akamai_policy_api_base_url.format(
|
self.akamai_policy_api_base_url.format(
|
||||||
configuration_number=self.http_conf_number,
|
configuration_number=self.http_conf_number,
|
||||||
policy_name='healthcheck'),
|
policy_name=unique_id),
|
||||||
data=json.dumps({'rules': []}),
|
data=json.dumps({'rules': []}),
|
||||||
headers=request_headers)
|
headers=request_headers)
|
||||||
|
|
||||||
if resp.ok:
|
if resp.ok:
|
||||||
|
try:
|
||||||
|
LOG.info('Policy with {0} created'.format(unique_id))
|
||||||
|
LOG.info('Akamai Health Check Succeeded')
|
||||||
|
self.policy_api_client.delete(
|
||||||
|
self.akamai_policy_api_base_url.format(
|
||||||
|
configuration_number=self.http_conf_number,
|
||||||
|
policy_name=unique_id))
|
||||||
|
except Exception as e:
|
||||||
|
LOG.warn(
|
||||||
|
'Akamai Health Check Succeeded but \
|
||||||
|
failed to delete policy:{0}'.format(e))
|
||||||
return True
|
return True
|
||||||
|
|
||||||
else:
|
else:
|
||||||
LOG.warn("Akamai Health Check Failed")
|
LOG.warn("Akamai Health Check Failed")
|
||||||
LOG.warn("Response Status Code : {0}".format(resp.status_code))
|
LOG.warn("Response Status Code : {0}".format(resp.status_code))
|
||||||
|
|
Loading…
Reference in New Issue