Ejemplo n.º 1
0
def new_cloudfiles_conn(username=None, api_key=None, **kwargs):
    kwargs = kwargs or dict()
    if not 'servicenet' in kwargs:
        kwargs['servicenet'] = True
    if not 'authurl' in kwargs:
        kwargs['authurl'] = auth_url
    return cloudfiles.Connection(*_credentials(username, api_key), **kwargs)
Ejemplo n.º 2
0
 def setUp(self):
     TransferTestMixin.setUp(self)
     self.container = 'transfer-test'
     self.key = 'path/to/candies'
     self.rdst = 'cf://%s/%s' % (self.container, self.key)
     self.conn = cloudfiles.Connection(os.environ['CLOUD_SERVERS_USERNAME'],
                                       os.environ['CLOUD_SERVERS_API_KEY'])
Ejemplo n.º 3
0
 def stub_swiftclient(self, expected_calls=1):
     if not hasattr(self, "swiftclient"):
         self.mox.StubOutWithMock(swift_client, 'Connection')
         self.swiftclient = self.mox.CreateMock(swift_client.Connection)
         while expected_calls:
             swift_client.Connection(auth=mox.IgnoreArg())\
                         .AndReturn(self.swiftclient)
             expected_calls -= 1
     return self.swiftclient
Ejemplo n.º 4
0
    def handle(self, *args, **options):
        """Main"""

        self.connection = cloudfiles.Connection(settings.CUMULUS['USERNAME'],
                                                settings.CUMULUS['API_KEY'])

        if len(args) == 1:
            lister = ContainerLister(self.connection, args[0])
            lister.run()

        else:
            self.list_all_containers()
Ejemplo n.º 5
0
    def getConnection(self):

        if self.config['cloud'] == 'amazon':
            from hydroConnection import HydroConnection
            self.connection = HydroConnection(self.config['key'],
                                              self.config['secret'])

        elif self.config['cloud'] == 'rackspace':
            import cloudfiles
            self.connection = cloudfiles.Connection(self.config['name'],
                                                    self.config['key'])

        if self.connection is None:
            raise ArgumentError, 'no connection returned'
        return self.connection
Ejemplo n.º 6
0
 def __init__(self, username, api_key, container_name):
     self.username = username
     self.api_key = api_key
     self.conn = cloudfiles.Connection(username=username, api_key=api_key)
     self.container = cloudfiles.Container(self.conn, name=container_name)