Skip to content

Commit

Permalink
Fixes 'cdn_enabled' status for containers. GitHub #423
Browse files Browse the repository at this point in the history
This is similar to the fix made in #399, but for the new object_storage
code.
  • Loading branch information
EdLeafe committed Jul 9, 2014
1 parent 4045210 commit 1ce7291
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion pyrax/object_storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,8 @@ def id(self):

def _set_cdn_defaults(self):
"""Sets all the CDN-related attributes to default values."""
self._cdn_enabled = False
if self._cdn_enabled is FAULT:
self._cdn_enabled = False
self._cdn_uri = None
self._cdn_ttl = DEFAULT_CDN_TTL
self._cdn_ssl_uri = None
Expand All @@ -182,11 +183,15 @@ def _fetch_cdn_data(self):
"""Fetches the object's CDN data from the CDN service"""
if self._cdn_enabled is FAULT:
headers = self.manager.fetch_cdn_data(self)
else:
headers = {}
# Set defaults in case not all headers are present.
self._set_cdn_defaults()
if not headers:
# Not CDN enabled; return
return
else:
self._cdn_enabled = True
for key, value in headers.items():
low_key = key.lower()
if low_key == "x-cdn-uri":
Expand Down

0 comments on commit 1ce7291

Please sign in to comment.