Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rackspace region support 95 #97

Open
wants to merge 4 commits into
base: v3
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions cactus/deployment/cloudfiles/engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ class CloudFilesDeploymentEngine(BaseDeploymentEngine):

def _create_connection(self):
username, api_key = self.credentials_manager.get_credentials()
region = self.site.config.get('cloudfiles-region', default='DFW')
pyrax.set_setting("identity_type", "rackspace")
pyrax.set_setting("region", region)
pyrax.set_credentials(username, api_key)
return pyrax.connect_to_cloudfiles()

Expand Down
12 changes: 8 additions & 4 deletions cactus/deployment/cloudfiles/file.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
#coding:utf-8

from pyrax.exceptions import NoSuchObject
from cactus.deployment.file import BaseFile
from cactus.utils.helpers import CaseInsensitiveDict


class CloudFilesFile(BaseFile):
def remote_changed(self):
obj = self.engine.bucket.get_object(self.url)
#TODO: Headers
return obj.etag != self.payload_checksum
try:
obj = self.engine.bucket.get_object(self.url)
#TODO: Headers
return obj.etag != self.payload_checksum
except (NoSuchObject, KeyError):
return True

def get_headers(self):
headers = CaseInsensitiveDict()
Expand All @@ -21,4 +25,4 @@ def get_headers(self):
def do_upload(self):
obj = self.engine.bucket.store_object(self.url, self.payload(), content_type=self.content_type,
etag=self.payload_checksum, content_encoding=self.content_encoding,)
obj.set_metadata(self.get_headers())
obj.set_metadata(self.get_headers())