diff --git a/storage/cloud.py b/storage/cloud.py index 9d0ae01d5..ff7f1a281 100644 --- a/storage/cloud.py +++ b/storage/cloud.py @@ -261,14 +261,30 @@ class _CloudStorage(BaseStorageV2): if (self.__class__ == destination.__class__ and self._access_key and self._secret_key and self._access_key == destination._access_key and - self._secret_key == destination._secret_key): + self._secret_key == destination._secret_key and + self._connect_kwargs == destination._connect_kwargs): + + # Initialize the cloud connection on the destination as well. + destination._initialize_cloud_conn() + + # Check the buckets for both the source and destination locations. + if self._cloud_bucket is None: + logger.error('Cloud bucket not found for location %s; Configuration is probably invalid!', + self._bucket_name) + return + + if destination._cloud_bucket is None: + logger.error('Cloud bucket not found for location %s; Configuration is probably invalid!', + destination._bucket_name) + return + + # Perform the copy. logger.debug('Copying file from %s to %s via a direct boto copy', self._cloud_bucket, destination._cloud_bucket) source_path = self._init_path(path) source_key = self._key_class(self._cloud_bucket, source_path) - destination._initialize_cloud_conn() dest_path = destination._init_path(path) source_key.copy(destination._cloud_bucket, dest_path) return