garbagecollect: Clean up errors
- Clean up error messages - Add a missing error check on the result of blobService.Enumerate. Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>master
							parent
							
								
									0eefe17730
								
							
						
					
					
						commit
						267e268775
					
				| 
						 | 
					@ -26,7 +26,7 @@ func markAndSweep(ctx context.Context, storageDriver driver.StorageDriver) error
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	repositoryEnumerator, ok := registry.(distribution.RepositoryEnumerator)
 | 
						repositoryEnumerator, ok := registry.(distribution.RepositoryEnumerator)
 | 
				
			||||||
	if !ok {
 | 
						if !ok {
 | 
				
			||||||
		return fmt.Errorf("coercion error: unable to convert Namespace to RepositoryEnumerator")
 | 
							return fmt.Errorf("unable to convert Namespace to RepositoryEnumerator")
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// mark
 | 
						// mark
 | 
				
			||||||
| 
						 | 
					@ -49,7 +49,7 @@ func markAndSweep(ctx context.Context, storageDriver driver.StorageDriver) error
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		manifestEnumerator, ok := manifestService.(distribution.ManifestEnumerator)
 | 
							manifestEnumerator, ok := manifestService.(distribution.ManifestEnumerator)
 | 
				
			||||||
		if !ok {
 | 
							if !ok {
 | 
				
			||||||
			return fmt.Errorf("coercion error: unable to convert ManifestService into ManifestEnumerator")
 | 
								return fmt.Errorf("unable to convert ManifestService into ManifestEnumerator")
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		err = manifestEnumerator.Enumerate(ctx, func(dgst digest.Digest) error {
 | 
							err = manifestEnumerator.Enumerate(ctx, func(dgst digest.Digest) error {
 | 
				
			||||||
| 
						 | 
					@ -70,7 +70,7 @@ func markAndSweep(ctx context.Context, storageDriver driver.StorageDriver) error
 | 
				
			||||||
			case *schema1.SignedManifest:
 | 
								case *schema1.SignedManifest:
 | 
				
			||||||
				signaturesGetter, ok := manifestService.(distribution.SignaturesGetter)
 | 
									signaturesGetter, ok := manifestService.(distribution.SignaturesGetter)
 | 
				
			||||||
				if !ok {
 | 
									if !ok {
 | 
				
			||||||
					return fmt.Errorf("coercion error: unable to convert ManifestSErvice into SignaturesGetter")
 | 
										return fmt.Errorf("unable to convert ManifestService into SignaturesGetter")
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
				signatures, err := signaturesGetter.GetSignatures(ctx, dgst)
 | 
									signatures, err := signaturesGetter.GetSignatures(ctx, dgst)
 | 
				
			||||||
				if err != nil {
 | 
									if err != nil {
 | 
				
			||||||
| 
						 | 
					@ -106,6 +106,9 @@ func markAndSweep(ctx context.Context, storageDriver driver.StorageDriver) error
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		return nil
 | 
							return nil
 | 
				
			||||||
	})
 | 
						})
 | 
				
			||||||
 | 
						if err != nil {
 | 
				
			||||||
 | 
							return fmt.Errorf("error enumerating blobs: %v", err)
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// Construct vacuum
 | 
						// Construct vacuum
 | 
				
			||||||
	vacuum := storage.NewVacuum(ctx, storageDriver)
 | 
						vacuum := storage.NewVacuum(ctx, storageDriver)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue