...
|
...
|
@@ -4,6 +4,7 @@ import (
|
4
|
4
|
"encoding/json"
|
5
|
5
|
"fmt"
|
6
|
6
|
"net/http"
|
|
7
|
+ "reflect"
|
7
|
8
|
"time"
|
8
|
9
|
|
9
|
10
|
"github.com/docker/distribution/registry/api/errcode"
|
...
|
...
|
@@ -252,16 +253,8 @@ func (*dryRunRegistryPinger) ping(registry string) error {
|
252
|
252
|
// Also automatically remove any image layer that is no longer referenced by any
|
253
|
253
|
// images.
|
254
|
254
|
func NewPruner(options PrunerOptions) Pruner {
|
255
|
|
- keepTagRevisions := "<nil>"
|
256
|
|
- if options.KeepTagRevisions != nil {
|
257
|
|
- keepTagRevisions = fmt.Sprintf("%d", *options.KeepTagRevisions)
|
258
|
|
- }
|
259
|
|
- pruneOverSizeLimit := "<nil>"
|
260
|
|
- if options.PruneOverSizeLimit != nil {
|
261
|
|
- pruneOverSizeLimit = fmt.Sprintf("%v", *options.PruneOverSizeLimit)
|
262
|
|
- }
|
263
|
|
- glog.V(1).Infof("Creating image pruner with keepYoungerThan=%v, keepTagRevisions=%s, pruneOverSizeLimit=%s, allImages=%t",
|
264
|
|
- options.KeepYoungerThan, keepTagRevisions, pruneOverSizeLimit, options.AllImages)
|
|
255
|
+ glog.V(1).Infof("Creating image pruner with keepYoungerThan=%v, keepTagRevisions=%s, pruneOverSizeLimit=%s, allImages=%s",
|
|
256
|
+ options.KeepYoungerThan, getValue(options.KeepTagRevisions), getValue(options.PruneOverSizeLimit), getValue(options.AllImages))
|
265
|
257
|
|
266
|
258
|
algorithm := pruneAlgorithm{}
|
267
|
259
|
if options.KeepYoungerThan != nil {
|
...
|
...
|
@@ -303,6 +296,13 @@ func NewPruner(options PrunerOptions) Pruner {
|
303
|
303
|
}
|
304
|
304
|
}
|
305
|
305
|
|
|
306
|
+func getValue(option interface{}) string {
|
|
307
|
+ if v := reflect.ValueOf(option); !v.IsNil() {
|
|
308
|
+ return fmt.Sprintf("%v", v.Elem())
|
|
309
|
+ }
|
|
310
|
+ return "<nil>"
|
|
311
|
+}
|
|
312
|
+
|
306
|
313
|
// addImagesToGraph adds all images to the graph that belong to one of the
|
307
|
314
|
// registries in the algorithm and are at least as old as the minimum age
|
308
|
315
|
// threshold as specified by the algorithm. It also adds all the images' layers
|