Merge pull request #1702 from harshavardhana/mirror

mirror/cp: Skip NoSuckKey, NoSuchBucket errors properly in cp/mirror.
This commit is contained in:
Krishna Srinivas
2016-04-28 14:40:01 +05:30
2 changed files with 16 additions and 12 deletions
+13
View File
@@ -148,6 +148,19 @@ func (c *s3Client) Get() (io.Reader, *probe.Error) {
if errResponse.Code == "AccessDenied" {
return nil, probe.NewError(PathInsufficientPermission{Path: c.targetURL.String()})
}
if errResponse.Code == "NoSuchBucket" {
return nil, probe.NewError(BucketDoesNotExist{
Bucket: bucket,
})
}
if errResponse.Code == "InvalidBucketName" {
return nil, probe.NewError(BucketInvalid{
Bucket: bucket,
})
}
if errResponse.Code == "NoSuchKey" || errResponse.Code == "InvalidArgument" {
return nil, probe.NewError(ObjectMissing{})
}
return nil, probe.NewError(e)
}
return reader, nil
+3 -12
View File
@@ -348,19 +348,10 @@ func doCopySession(session *sessionV7) {
// For all non critical errors we can continue for the
// remaining files.
switch cpURLs.Error.ToGoError().(type) {
// Handle this specifically for filesystem related
// errors.
case BrokenSymlink:
// Handle this specifically for filesystem related errors.
case BrokenSymlink, TooManyLevelsSymlink, PathNotFound, PathInsufficientPermission:
continue
case TooManyLevelsSymlink:
continue
case PathNotFound:
continue
case PathInsufficientPermission:
continue
case ObjectAlreadyExists:
continue
case BucketDoesNotExist:
case BucketNameEmpty, ObjectMissing, ObjectAlreadyExists, BucketDoesNotExist, BucketInvalid:
continue
}
// For critical errors we should exit. Session