CloudFiles upload handler and setup.cfg tweak

This commit is contained in:
Sandy Walsh 2014-06-03 02:08:24 +00:00
parent 1ef14d82bf
commit 29ec822b67
4 changed files with 14 additions and 8 deletions

View File

@ -1,5 +1,3 @@
identity_type = rackspace
[rackspace_cloud]
username = my_username
api_key = 01234567890abcdef

View File

@ -6,7 +6,7 @@ summary = data archiving library
description-file = README.md
license = Apache-2
classifier =
Development Status :: 2 - Pre-Alpha
Development Status :: 5 - Production/Stable
Environment :: Console
Intended Audience :: Developers
Intended Audience :: Information Technology
@ -14,9 +14,12 @@ classifier =
Operating System :: OS Independent
Programming Language :: Python
Topic :: Software Development :: Libraries :: Python Modules
home-page = https://github.com/StackTach/shoebox
keywords =
setup
distutils
json
archive
swift
openstack
[files]
packages =
shoebox
shoebox

View File

@ -90,7 +90,7 @@ class MoveFileCallback(ArchiveCallback):
class DeleteFileCallback(ArchiveCallback):
def on_close(self, filename):
"""Delete this file."""
os.delete(filename)
os.remove(filename)
return None
@ -102,7 +102,11 @@ class SwiftUploadCallback(ArchiveCallback):
raise MissingArgument("No credentials_file defined.")
self.container = kwargs.get('container', 'shoebox')
self.auth_method = kwargs.get('auth_method', 'rackspace')
self.region = kwargs.get('region', 'DFW')
pyrax.set_setting('identity_type', self.auth_method)
pyrax.set_setting("region", self.region)
pyrax.set_credential_file(self.credentials_file)
self.cloud_files = pyrax.cloudfiles
@ -111,5 +115,5 @@ class SwiftUploadCallback(ArchiveCallback):
checksum = pyrax.utils.get_checksum(filename)
# Blocking call ...
obj = self.cloud_files.upload_file(self.container, filename,
etag=chksum)
etag=checksum)
return filename

View File

@ -8,6 +8,7 @@ deps =
mock
notigen
notification_utils
pyrax
python-dateutil
simport